Skip to content

Commit

Permalink
convert PaperAirplaneNode to ES6, phetsims/tasks#1044
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom committed Sep 10, 2020
1 parent 9db974a commit 04211f9
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions js/PaperAirplaneNode.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
// Copyright 2014-2020, University of Colorado Boulder

/**
* The paper airplane that is part of the PhET logo.
* PaperAirplaneNode draws the paper airplane that is part of the PhET logo.
*
* @author John Blanco
*/

import Shape from '../../kite/js/Shape.js';
import inherit from '../../phet-core/js/inherit.js';
import merge from '../../phet-core/js/merge.js';
import Path from '../../scenery/js/nodes/Path.js';
import PhetColorScheme from './PhetColorScheme.js';
import sceneryPhet from './sceneryPhet.js';

/**
* @param {Object} [options]
* @constructor
*/
function PaperAirplaneNode( options ) {
options = merge( {
fill: PhetColorScheme.PHET_LOGO_YELLOW
}, options );

// Define the shape, from the points in the PhET Logo AI file, see https://github.com/phetsims/scenery-phet/issues/75
// The bounds offset were determined by getting bodyShape.bounds.minX, bodyShape.bounds.minY, and the shape
// is adjusted to have top/left at (0,0)
const dx = 221.92;
const dy = 114.975;
const bodyShape = new Shape()
.moveTo( 221.92 - dx, 131.225 - dy )
.lineTo( 234.307 - dx, 135.705 - dy )
.lineTo( 250.253 - dx, 122.428 - dy )
.lineTo( 237.983 - dx, 136.955 - dy )
.lineTo( 251.236 - dx, 141.627 - dy )
.lineTo( 256.021 - dx, 114.975 - dy )
.close()

// Lower part
.moveTo( 238.004 - dx, 139.547 - dy )
.lineTo( 238.312 - dx, 146.48 - dy )
.lineTo( 243.254 - dx, 141.54 - dy )
.close();

Path.call( this, bodyShape, options );
class PaperAirplaneNode extends Path {

/**
* @param {Object} [options]
*/
constructor( options ) {

options = merge( {
fill: PhetColorScheme.PHET_LOGO_YELLOW
}, options );

// Define the shape, from the points in the PhET Logo AI file, see https://github.com/phetsims/scenery-phet/issues/75
// The bounds offset were determined by getting bodyShape.bounds.minX, bodyShape.bounds.minY, and the shape
// is adjusted to have top/left at (0,0)
const dx = 221.92;
const dy = 114.975;
const bodyShape = new Shape()
.moveTo( 221.92 - dx, 131.225 - dy )
.lineTo( 234.307 - dx, 135.705 - dy )
.lineTo( 250.253 - dx, 122.428 - dy )
.lineTo( 237.983 - dx, 136.955 - dy )
.lineTo( 251.236 - dx, 141.627 - dy )
.lineTo( 256.021 - dx, 114.975 - dy )
.close()

// Lower part
.moveTo( 238.004 - dx, 139.547 - dy )
.lineTo( 238.312 - dx, 146.48 - dy )
.lineTo( 243.254 - dx, 141.54 - dy )
.close();

super( bodyShape, options );
}
}

sceneryPhet.register( 'PaperAirplaneNode', PaperAirplaneNode );

inherit( Path, PaperAirplaneNode );
export default PaperAirplaneNode;

0 comments on commit 04211f9

Please sign in to comment.