Giter Site home page Giter Site logo

cc-workshop-prep's Introduction

Part A. P5 Creative Coding

1. Install Node-JS

Download (choose the recommended one on the left)

2. Go to Application -> Other -> Terminal, type

npx create-react-app cc-workshop-demo

3. When finished, type

cd cc-workshop-demo;npm start

4. Your browser will automatically open, you should be able to see this following screen:

alt text

5. Switch back to terminal, press command + T to open a new tab, and type

npm i react-p5-wrapper —save

6. When finished, type

vi package.json

and you should be able to see the following line

"react-p5-wrapper": "0.0.4",

7. When confirmed, type the following command to quit vim

:wq

8. Install Atom - Text editor

Download

9. When finished, switch back to terminal, click command + T to open a new tab, and then type

cd ..;open .

10. Open the cc-workshop-demo folder with Atom, and you should be able to see this

alt text

11. Click the file src/App.js, and replace the entire file with the following code

import React, { Component } from 'react';
import './App.css';
//dependencies
import P5Wrapper from 'react-p5-wrapper';

class App extends Component {

  render() {
    return (
      <div className="App">
      </div>
    );
  }

}

export default App;

12. Right click on the src folder icon and create a new file, name it “sketch.js”, and then copy the following code

export default function sketch (p) {

  p.preload = function () {

  }

  p.setup = function () {
    p.createCanvas(600, 400, p.WEBGL);
  };

  p.myCustomRedrawAccordingToNewPropsHandler = function (props) {

  };

  p.draw = function () {
    p.background(255);
    p.rotateX(p.frameCount * 0.01);
    p.rotateY(p.frameCount * 0.01);
    p.box(50);
  };
};

13. Click the file src/App.js, and add the following code below line 4

import sketch from './sketch';

And the following code below line 11

<P5Wrapper sketch={sketch}/>

14. Switch to browser, you should be able to see a spinning box. Congrats, you are now all set!

alt text

Part B. Hardwares & Arduino

Due to security concern, our employee laptops (Beijing Office) do not support serial I/O (our keyboards are the only source of input), which means if you want to get hands on Part B, please bring your own laptop to the workshop, I will guide you through the rest of the installation steps.

Sorry for the inconvenience.

cc-workshop-prep's People

Contributors

dachang avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.