Skip to content

Instantly share code, notes, and snippets.

Avatar

J.D. Zamfirescu zamfi

View GitHub Profile
View cyoa-inputs.js
import React, { Component } from "react";
import "./styles.css";
class StartPage extends Component {
render() {
return (
<div>
<p>Welcome, traveler! What is your name?</p>
<input
View cyoa-components.js
import React, { Component } from "react";
import "./styles.css";
class StartPage extends Component {
render() {
return <div>
<p>Welcome, traveler! How would you like to get to your destination?</p>
<button onClick={() => this.props.goToPage(TrainPage)}>Train</button>
<button onClick={() => this.props.goToPage()}>Ship</button>
View falling-circles.js
// Falling circles
var circles = [];
// feel free to add more blank lines here to see the table better!
var DIAMETER = 10;
function setup() {
createCanvas(340, 340);
}
View loop-constructed-circles.js
// A few more circles
var circles = [];
// feel free to add more blank lines here to see the table better!
var DIAMETER = 30;
function setup() {
createCanvas(340, 340);
for (var x = 50; x <= width-50; x += DIAMETER*2) {
View more-circles.js
// A few more circles
var circles = [];
var DIAMETER = 30;
function setup() {
createCanvas(340, 340);
for (var i = 0; i < 10; i += 1) {
View three-circles.js
// Just a few circles
var circles = [
{ x: 30, y: 40, vx: 3, vy: 2, h: 10 },
{ x: 90, y: 120, vx: 2, vy: 3, h: 120 },
{ x: 300, y: 240, vx: -2, vy: -1, h: 300 }
];
var DIAMETER = 30;
View dropping-circles.js
// dropping circles, phase 1
// the circles array!
var circles = [];
function setup() {
createCanvas(340, 340);
// add three circles
for (var i = 0; i < 3; i += 1) {
View arrays-of-objects.js
var people = [
{
name: "J.D. Zamfirescu",
food: "宫保鸡丁",
color: "blue"
},
{
name: "Adam Smith",
food: "小笼包",
color: "red"
View jd-object.js
var jd = {
name: "J.D. Zamfirescu",
food: "宫保鸡丁",
color: "blue"
};
textAlign(CENTER);
fill(0);
textSize(15);
View hues-array.js
var hues = [14,134,13,65,134,243,95,68,345];
colorMode(HSB);
noStroke();
for (var i = 0; i < hues.length; i += 1) {
fill(hues[i], 100, 100);
ellipse(20+i * 30, height/2, 15);
}
You can’t perform that action at this time.