Esempio n. 1
0
  colorRandom: function(elts, initialColor) {
    var randColor = Please.make_color();

    elts.forEach(function(elt) {
      elt.animate({ fill: randColor }, 1000, function() {
        elts.animate({ fill: initialColor }, 1000);
      });
    });
  },
Esempio n. 2
0
  render() {
    const color = this.state.colorify ? Please.make_color({
      seed: this.state.username,
      saturation: 0.4,
      value: 0.9,
      golden: false
    }) : "";

    const className = this.state.highlight ? "User command" : "User";

    return (
      <div className={className} style={{color: color}}>{this.state.username}</div>
    );
  }
Esempio n. 3
0
  render() {
    const { user, highlight, colorify } = this.state

    const className = highlight ? "User command" : "User"
    const color = colorify ? Please.make_color({
      seed: user ? user.name : '',
      saturation: 0.4,
      value: 0.9,
      golden: false
    }) : ""

    return (
      <div
        className={className}
        style={{ color: user ? color : 'rgb(96, 96, 96)' }}
        onClick={this.props.onShowProfile}
      >
        {user ? user.name : ''}
      </div>
    )
  }
Esempio n. 4
0
	async.times(times, function(n, next) {
		var name = 'playfield-' + n + '.png';

		gm(isFS ? 1080 : 1920, isFS ? 1920 : 1080, pleasejs.make_color()).toBuffer('PNG', function(err, data) {
			if (err) {
				throw err;
			}
			request
				.post('/storage/v1/files')
				.query({ type: fileType })
				.type(mimeType)
				.set('Content-Disposition', 'attachment; filename="' + name + '"')
				.set('Content-Length', data.length)
				.send(data)
				.as(user)
				.end(function(err, res) {
					expect(err).to.not.be.ok();
					expect(res.status).to.be(201);
					next(null, res.body);
				});
		});

	}, function(err, playfields) {
Esempio n. 5
0
exports.createBackglass = function(user, request, done) {

	var fileType = 'backglass';
	var mimeType = 'image/png';
	var name = 'backglass.png';
	gm(640, 512, pleasejs.make_color()).toBuffer('PNG', function(err, data) {
		if (err) {
			throw err;
		}
		request
			.post('/storage/v1/files')
			.query({ type: fileType })
			.type(mimeType)
			.set('Content-Disposition', 'attachment; filename="' + name + '"')
			.set('Content-Length', data.length)
			.send(data)
			.as(user)
			.end(function(err, res) {
				expect(err).to.not.be.ok();
				expect(res.status).to.be(201);
				done(res.body);
			});
	});
};
Esempio n. 6
0
function newColor() {
  return please.make_color({
    saturation  : 1.0,
    value       : 0.8,
  })[0];
}
import { PropTypes } from 'react';
import Please        from 'pleasejs';
import classNames    from 'classnames';

const MAX_COLORS = 26;
const COLORS = Please.make_color({
  base_color: '#c60c30',
  colors_returned: MAX_COLORS
});
const FIRST_LETTER_CHAR_CODE = 'A'.charCodeAt();

const UserAvatar = ({
  user,
  role
}) => {
  if (role && user.avatar_image) {
    const cssClasses = classNames(
      'left',
      {
        'admin-avatar':     role === 'administrator',
        'moderator-avatar': role === 'moderator',
        'avatar':           role === 'organization'
      }
    );

    return (
      <img src={user.avatar_image} width="32" height="32" className={cssClasses} />
    );
  } else if (user.name) {
    const firstLetter = user.name[0].toUpperCase();
    const style = {
Esempio n. 8
0
var Please = require('pleasejs');

var baseColor = Please.make_color();
var colors = Please.make_color({
    base_color: baseColor[0],
    colors_returned: 100
});

var baseX = Math.floor(Math.random() * 1000) + 250;
var baseY = Math.floor(Math.random() * 1000) + 250;

var divs = [
    {
        "text": "",
        "style": "border-width:75px;border-style:solid;border-color:transparent transparent " + colors[0] + " " + colors[0] + ";left:" + baseX + "px;top:" + (baseY+26) + "px;position:absolute;overflow:hidden;max-height:300px;max-width:300px;transform:rotate(-135deg)"
    },
    {
        "text": "",
        "style": "border-width: 75px;border-style:solid;border-color:transparent transparent " + colors[1] + " " + colors[1] + ";left: " + (baseX+107) + "px;top:" + (baseY-80) + "px;position:absolute;overflow:hidden;max-height:300px;max-width:300px;transform: rotate(-45deg);"
    },
    {
        "text": "",
        "style": "border-width:50px;border-style:solid;border-color:transparent transparent " + colors[2] + " " + colors[2] + ";left: " + (baseX+187) + "px;top: " + (baseY+103) + "px;position:absolute;overflow:hidden;max-height:300px;max-width:300px;transform: rotate(-90deg);"
    },
    {
        "text": "",
        "style": "border-width: 35px;border-style:solid;border-color:transparent transparent " + colors[3] + " " + colors[3] + ";left: " + (baseX+253) + "px;top: " + (baseY+11) + "px;position:absolute;overflow:hidden;max-height:300px;max-width:300px;transform: rotate(45deg);"
    },
    {
        "text": "",
        "style": "border-width: 35px;border-style:solid;border-color:transparent transparent " + colors[4] + " " + colors[4] + ";left: " + (baseX+152) + "px;top: " + (baseY+112) + "px;position:absolute;overflow:hidden;max-height:300px;max-width:300px;transform:rotate(135deg)"
Esempio n. 9
0
exports.createDirectB2S = function(user, request, gameName, done) {

	if (_.isFunction(gameName)) {
		done = gameName;
		gameName = 'aavenger';
	}

	gm(1280, 1024, pleasejs.make_color()).toBuffer('PNG', function(err, image) {
		if (err) {
			throw err;
		}
		let data = `<B2SBackglassData Version="1.2">
					  <ProjectGUID Value="41664711-BFB7-4911-ABE1-31542BFD0014" />
					  <ProjectGUID2 Value="C29873B0-D97B-4461-91CD-8897167F5CA0" />
					  <AssemblyGUID Value="BF0C830A-6FFB-449C-8770-68E2D3A9FFF3" />
					  <Name Value="VPDB Test" />
					  <VSName Value="VPDB Test.vpt" />
					  <DualBackglass Value="0" />
					  <Author Value="test" />
					  <Artwork Value="test" />
					  <GameName Value="${gameName}" />
					  <TableType Value="3" />
					  <AddEMDefaults Value="0" />
					  <DMDType Value="1" />
					  <CommType Value="1" />
					  <DestType Value="1" />
					  <NumberOfPlayers Value="4" />
					  <B2SDataCount Value="5" />
					  <ReelType Value="" />
					  <UseDream7LEDs Value="1" />
					  <D7Glow Value="0" />
					  <D7Thickness Value="0" />
					  <D7Shear Value="0" />
					  <ReelRollingDirection Value="0" />
					  <ReelRollingInterval Value="0" />
					  <ReelIntermediateImageCount Value="0" />
					  <GrillHeight Value="0" />
					  <DMDDefaultLocationX Value="0" />
					  <DMDDefaultLocationY Value="0" />
					  <Animations />
					  <Scores />
					  <Illumination />
					  <Images>
						<ThumbnailImages>
						  <MainImage Image="iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACx&#xD;&#xA;jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAvSURBVFhH7c4hAQAACAMw+tDfvhrEuJmY3+zm&#xD;&#xA;mgQEBAQEBAQEBAQEBAQEBMqB3AOdXkx5NpzLCAAAAABJRU5ErkJggg==" />
						</ThumbnailImages>
						<BackgroundImages>
						  <MainImage Type="0" RomID="0" RomIDType="0" FileName="backlglass.png" Image="${image.toString('base64')}" />
						</BackgroundImages>
						<IlluminatedImages />
						<DMDImages>
						  <MainImage />
						</DMDImages>
					  </Images>
					</B2SBackglassData>`;
		request
			.post('/storage/v1/files')
			.query({ type: 'backglass' })
			.type('application/x-directb2s')
			.set('Content-Disposition', 'attachment; filename="test.directb2s"')
			.set('Content-Length', data.length)
			.send(data)
			.as(user)
			.end(function(err, res) {
				expect(err).to.not.be.ok();
				expect(res.status).to.be(201);
				done(res.body);
			});
	});
};