Skip to content

Instantly share code, notes, and snippets.

@antonkartashov
Created February 5, 2017 22:58
Show Gist options
  • Save antonkartashov/e420b60fcacc59833c02e825e13556e2 to your computer and use it in GitHub Desktop.
Save antonkartashov/e420b60fcacc59833c02e825e13556e2 to your computer and use it in GitHub Desktop.
"use strict"
// Variables and Constants
let x = 2
const obj = {
a: 10,
b: 20,
c: 30
}
// Layers, States, Events
const layerA = new Layer({
width: Screen.width,
backgroundColor: "tomato"
})
layerA.states.stateA = {
y: 200,
x: 100,
options: {
time: 10,
curve: "ease-out"
}
}
// layerA.onTap(function() {
// this.animate({
layerA.onTap(() => {
layerA.animate({
x: 100,
options: {
time: 2,
curve: "ease-in"
}
})
})
let d = 10
let c = 20
// const objA = {
// d: d,
// c: c,
// fn: function() {print("Hello")}
// }
const objA = {
d,
c,
fn() {print("Hello")}
}
// Loops
const layers = []
// for (let i of Array(10).keys()) {
for (let i = 0; i < 10; i += 1) {
let layer = new Layer()
layers.push(layer)
}
for (let layer of layers) {
let i = layers.indexOf(layer)
print(i, layer)
}
const sketch = {
"layerA": "<Layer id: 41 (0, 0) 200×200>",
"layerB": "<Layer id: 42 (0, 0) 200×200>",
"layerC": "<Layer id: 43 (0, 0) 200×200>"
}
for (let name in sketch)
print(`This is ${name} from Sketch`)
// If … else
let y
x = y = 1
if ((x > 10) && (y != 20))
print("Yo")
else
print("Hey")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment