SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Downloaden Sie, um offline zu lesen
Designing with Code
                  simple intro/review
                  of some useful
                  programming basics




                      design and information architecture/ysdn 3006
Designing with Code


                      Object Oriented Programming
                      •   OOPs
                      •   Processing, ActionScript, Java, Javascript
                      •   use of objects, functions and methods


                      Frameworks
                      •   jQuery, Tweener, Hype, Papervision,
                      •   a reusable set of libraries or classes for software systems


                      Syntax
                      •   grammar “rules” specific to each language
                      •   but all OOPs language have some things in common
Designing with Code

  Classes
  •   class defines the properties and methods available
  •   each object falls under a single class
  •   eg. MovieClip, TextField,Video - ActionScript
  •   individual object - instance




                     Objects
                     •   smaller building blocks - easier to work with
                     •   way to group variables with related functions
                     •   eg. PImage, PFont, PShape - Processing
                     •   specific properties and/or methods
Designing with Code

                                                        Class radio


                                          }       this object is an
                                                  instance of radio class




                         {
                             volume


                                                        }
            properties       band        setVolume
     attributes, fields                   setBand            methods
                             power
                                         setPower           actions, behaviours, callout
                             frequency
                                         setFrequency
Designing with Code

   Functions
   •   basic building blocks of OOP
   •   independent units that work together
   •   eg. background(), size(), stroke()- Processing
   •   can be built in or custom
Designing with Code
                                                                             int myWidth = (320*2);
                                                                             int myHeight = (240 + 240);
  Variables                                                                  int mySquare = 60;
                                                                             int myCircle = 60;
                                                                             //show the value of a variable in the console
  •   types of variables - int, float,                                        println(myCircle);
  •   a holder for value                                                     //sometimes you need more info
                                                                             println("myCircle" + myCircle);
  •   value can be an expression used as parameters                          // formatting like this is called concatenation
                                                                             println("myCircle" + "" + " — " + myCircle);
                                                                             background(0);
                                                                             size(myWidth, myHeight );
                                                                             rect(30, 30, mySquare, mySquare);
                                                                             ellipse(130, 60, myCircle, myCircle);




                                                      int myWidth = (320*2);
                                                      int myHeight = (240 + 240);
                                                      int mySquare = 60;
                                                      int myCircle = 60;
                                                      background(0);
                                                      size(myWidth, myHeight );
                                                      rect(30, 30, mySquare, mySquare);
                                                      ellipse(130, 60, myCircle,
                                                      myCircle);
Designing with Code

  Arrays
  •   create multiple variables without defining a new name for each
  •   code shorter, easier to read and update
Designing with Code


     Arrays
     •   To make an array, just place brackets after the data type:              int[] x;


     •   The beauty of creating an array is the ability to make 2, 10, or
         100,000 variable values with only one line of code. For instance, the
         following line creates an array of 2,000 integer variables:
                                                                          int[] x = new int[2000];

     •   Arrays can also be made of other data types like images:


                           PImage[] images = new PImage[32];
Designing with Code                                                   too many variables
                                                                      float x1 = -10;
  Arrays                                                              float x2 = 10;
                                                                      float x3 = 35;
  •   create multiple variables without defining a new name for each   float x4 = 18;
                                                                      float x5 = 30;
  •   code shorter, easier to read and update
                                                                      void setup() {
                                                                        size(240, 120);
                                                                        smooth();
                                                                        noStroke();
                                                                      }

                                                                      void draw() {
                                                                        background(0);
                                                                        x1 += 0.5;
                                                                        x2 += 0.5;
                                                                        x3 += 0.5;
                                                                        x4 += 0.5;
                                                                        x5 += 0.5;
                                                                        arc(x1, 20, 20, 20, 0.52, 5.76);
                                                                        arc(x2, 40, 20, 20, 0.52, 5.76);
                                                                        arc(x3, 60, 20, 20, 0.52, 5.76);
                                                                        arc(x4, 80, 20, 20, 0.52, 5.76);
                                                                        arc(x5, 100, 20, 20, 0.52, 5.76);
                                                                      }
Designing with Code                                                            Let the array store
                                                                                  the variables
  Arrays
                                                                               float[] x = new float[3000];
  •   this examples shows 3000 variables in an array                           void setup() {
  •   using repetition loop to work with large arrays keeps the code concise     size(240, 120);
  •   need to know the length of the array                                       smooth();
                                                                                 noStroke();
                                                                                 fill(255, 200);
                                                                                 for (int i = 0; i < x.length; i++) {
                                                                                   x[i] = random(-1000, 200);
                                                                                 }
                                                                               }
                                                                               void draw() {
                                                                                 background(0);
                                                                                 for (int i = 0; i < x.length; i++) {
                                                                                   x[i] += 0.5;
                                                                                   float y = i * 0.4;
                                                                                   arc(x[i], y, 12, 12, 0.52, 5.76);
                                                                                 }
                                                                               }
that’s it for now ....
we will get into this more in the coming classes




                                 design and information architecture/ysdn 3006

Weitere ähnliche Inhalte

Was ist angesagt?

XNA L09–2D Graphics and Particle Engines
XNA L09–2D Graphics and Particle EnginesXNA L09–2D Graphics and Particle Engines
XNA L09–2D Graphics and Particle Engines
Mohammad Shaker
 
Gazr
GazrGazr
Gazr
kuro7
 
Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27
MongoDB
 
Html5 game programming overview
Html5 game programming overviewHtml5 game programming overview
Html5 game programming overview
민태 김
 
Encontra presentation
Encontra presentationEncontra presentation
Encontra presentation
Ricardo Dias
 

Was ist angesagt? (19)

Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 Canvas
 
tutorial5
tutorial5tutorial5
tutorial5
 
Introduction to HTML5 Canvas
Introduction to HTML5 CanvasIntroduction to HTML5 Canvas
Introduction to HTML5 Canvas
 
C# v8 new features - raimundas banevicius
C# v8 new features - raimundas baneviciusC# v8 new features - raimundas banevicius
C# v8 new features - raimundas banevicius
 
The Ring programming language version 1.5.1 book - Part 46 of 180
The Ring programming language version 1.5.1 book - Part 46 of 180The Ring programming language version 1.5.1 book - Part 46 of 180
The Ring programming language version 1.5.1 book - Part 46 of 180
 
XNA L09–2D Graphics and Particle Engines
XNA L09–2D Graphics and Particle EnginesXNA L09–2D Graphics and Particle Engines
XNA L09–2D Graphics and Particle Engines
 
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and VisageHacking JavaFX with Groovy, Clojure, Scala, and Visage
Hacking JavaFX with Groovy, Clojure, Scala, and Visage
 
Objective-C Crash Course for Web Developers
Objective-C Crash Course for Web DevelopersObjective-C Crash Course for Web Developers
Objective-C Crash Course for Web Developers
 
Html5 canvas
Html5 canvasHtml5 canvas
Html5 canvas
 
Gazr
GazrGazr
Gazr
 
Rubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for RubyRubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for Ruby
 
Statistical Schema Induction
Statistical Schema InductionStatistical Schema Induction
Statistical Schema Induction
 
OpenCascade Technology Overview: Visualization
OpenCascade Technology Overview: VisualizationOpenCascade Technology Overview: Visualization
OpenCascade Technology Overview: Visualization
 
Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27Mongoseattle indexing-2010-07-27
Mongoseattle indexing-2010-07-27
 
HTML5 Canvas
HTML5 CanvasHTML5 Canvas
HTML5 Canvas
 
Indexing and Query Optimizer (Richard Kreuter)
Indexing and Query Optimizer (Richard Kreuter)Indexing and Query Optimizer (Richard Kreuter)
Indexing and Query Optimizer (Richard Kreuter)
 
JavaScript Obfuscation
JavaScript ObfuscationJavaScript Obfuscation
JavaScript Obfuscation
 
Html5 game programming overview
Html5 game programming overviewHtml5 game programming overview
Html5 game programming overview
 
Encontra presentation
Encontra presentationEncontra presentation
Encontra presentation
 

Ähnlich wie Coding for

Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
Alok Kumar
 
Cassandra Tutorial
Cassandra TutorialCassandra Tutorial
Cassandra Tutorial
mubarakss
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
sharp-blade
 
MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome Bits
Spiffy
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
sharp-blade
 
Forking Oryx at Intalio
Forking Oryx at IntalioForking Oryx at Intalio
Forking Oryx at Intalio
Antoine Toulme
 

Ähnlich wie Coding for (20)

Lec2
Lec2Lec2
Lec2
 
tutorial5
tutorial5tutorial5
tutorial5
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Stupid Canvas Tricks
Stupid Canvas TricksStupid Canvas Tricks
Stupid Canvas Tricks
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
오브젝트C(pdf)
오브젝트C(pdf)오브젝트C(pdf)
오브젝트C(pdf)
 
Cassandra Tutorial
Cassandra TutorialCassandra Tutorial
Cassandra Tutorial
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
 
MS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome BitsMS TechDays 2011 - HTML 5 All the Awesome Bits
MS TechDays 2011 - HTML 5 All the Awesome Bits
 
MATLAB & Image Processing
MATLAB & Image ProcessingMATLAB & Image Processing
MATLAB & Image Processing
 
Adding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of TricksAdding Riak to your NoSQL Bag of Tricks
Adding Riak to your NoSQL Bag of Tricks
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
 
Introduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicoxIntroduction to web programming for java and c# programmers by @drpicox
Introduction to web programming for java and c# programmers by @drpicox
 
Forking Oryx at Intalio
Forking Oryx at IntalioForking Oryx at Intalio
Forking Oryx at Intalio
 
Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例Cocos2dを使ったゲーム作成の事例
Cocos2dを使ったゲーム作成の事例
 
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptxDIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
DIGITAL_SIGNAL_AND_IMAGE_PROCESSING_USIN.pptx
 
Spark schema for free with David Szakallas
Spark schema for free with David SzakallasSpark schema for free with David Szakallas
Spark schema for free with David Szakallas
 
HTML5 Graphics - Canvas and SVG
HTML5 Graphics - Canvas and SVGHTML5 Graphics - Canvas and SVG
HTML5 Graphics - Canvas and SVG
 
C* for Deep Learning (Andrew Jefferson, Tracktable) | Cassandra Summit 2016
C* for Deep Learning (Andrew Jefferson, Tracktable) | Cassandra Summit 2016C* for Deep Learning (Andrew Jefferson, Tracktable) | Cassandra Summit 2016
C* for Deep Learning (Andrew Jefferson, Tracktable) | Cassandra Summit 2016
 

Kürzlich hochgeladen

Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
drmarathore
 
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
wpkuukw
 
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
yhavx
 
怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证
怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证
怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证
eeanqy
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
CristineGraceAcuyan
 
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
awasv46j
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement
210303105569
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
mark11275
 

Kürzlich hochgeladen (20)

TRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptxTRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptx
 
How to Create a Productive Workspace Trends and Tips.pdf
How to Create a Productive Workspace Trends and Tips.pdfHow to Create a Productive Workspace Trends and Tips.pdf
How to Create a Productive Workspace Trends and Tips.pdf
 
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
Abortion pills in Kuwait 🚚+966505195917 but home delivery available in Kuwait...
 
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
一比一定(购)滑铁卢大学毕业证(UW毕业证)成绩单学位证
 
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
一比一原版(ANU毕业证书)澳大利亚国立大学毕业证原件一模一样
 
Mohanlalganj ! Call Girls in Lucknow - 450+ Call Girl Cash Payment 9548273370...
Mohanlalganj ! Call Girls in Lucknow - 450+ Call Girl Cash Payment 9548273370...Mohanlalganj ! Call Girls in Lucknow - 450+ Call Girl Cash Payment 9548273370...
Mohanlalganj ! Call Girls in Lucknow - 450+ Call Girl Cash Payment 9548273370...
 
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best ServiceHigh Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
High Profile Escorts Nerul WhatsApp +91-9930687706, Best Service
 
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime PondicherryPondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
Pondicherry Escorts Service Girl ^ 9332606886, WhatsApp Anytime Pondicherry
 
怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证
怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证
怎样办理伦敦国王学院毕业证(KCL毕业证书)成绩单留信认证
 
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Mysore [ 7014168258 ] Call Me For Genuine Models We...
 
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEKLANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
 
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
 
Independent Escorts Goregaon WhatsApp +91-9930687706, Best Service
Independent Escorts Goregaon WhatsApp +91-9930687706, Best ServiceIndependent Escorts Goregaon WhatsApp +91-9930687706, Best Service
Independent Escorts Goregaon WhatsApp +91-9930687706, Best Service
 
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahim
 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
 
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for FriendshipRaebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 

Coding for

  • 1. Designing with Code simple intro/review of some useful programming basics design and information architecture/ysdn 3006
  • 2. Designing with Code Object Oriented Programming • OOPs • Processing, ActionScript, Java, Javascript • use of objects, functions and methods Frameworks • jQuery, Tweener, Hype, Papervision, • a reusable set of libraries or classes for software systems Syntax • grammar “rules” specific to each language • but all OOPs language have some things in common
  • 3. Designing with Code Classes • class defines the properties and methods available • each object falls under a single class • eg. MovieClip, TextField,Video - ActionScript • individual object - instance Objects • smaller building blocks - easier to work with • way to group variables with related functions • eg. PImage, PFont, PShape - Processing • specific properties and/or methods
  • 4. Designing with Code Class radio } this object is an instance of radio class { volume } properties band setVolume attributes, fields setBand methods power setPower actions, behaviours, callout frequency setFrequency
  • 5. Designing with Code Functions • basic building blocks of OOP • independent units that work together • eg. background(), size(), stroke()- Processing • can be built in or custom
  • 6. Designing with Code int myWidth = (320*2); int myHeight = (240 + 240); Variables int mySquare = 60; int myCircle = 60; //show the value of a variable in the console • types of variables - int, float, println(myCircle); • a holder for value //sometimes you need more info println("myCircle" + myCircle); • value can be an expression used as parameters // formatting like this is called concatenation println("myCircle" + "" + " — " + myCircle); background(0); size(myWidth, myHeight ); rect(30, 30, mySquare, mySquare); ellipse(130, 60, myCircle, myCircle); int myWidth = (320*2); int myHeight = (240 + 240); int mySquare = 60; int myCircle = 60; background(0); size(myWidth, myHeight ); rect(30, 30, mySquare, mySquare); ellipse(130, 60, myCircle, myCircle);
  • 7. Designing with Code Arrays • create multiple variables without defining a new name for each • code shorter, easier to read and update
  • 8. Designing with Code Arrays • To make an array, just place brackets after the data type: int[] x; • The beauty of creating an array is the ability to make 2, 10, or 100,000 variable values with only one line of code. For instance, the following line creates an array of 2,000 integer variables: int[] x = new int[2000]; • Arrays can also be made of other data types like images: PImage[] images = new PImage[32];
  • 9. Designing with Code too many variables float x1 = -10; Arrays float x2 = 10; float x3 = 35; • create multiple variables without defining a new name for each float x4 = 18; float x5 = 30; • code shorter, easier to read and update void setup() { size(240, 120); smooth(); noStroke(); } void draw() { background(0); x1 += 0.5; x2 += 0.5; x3 += 0.5; x4 += 0.5; x5 += 0.5; arc(x1, 20, 20, 20, 0.52, 5.76); arc(x2, 40, 20, 20, 0.52, 5.76); arc(x3, 60, 20, 20, 0.52, 5.76); arc(x4, 80, 20, 20, 0.52, 5.76); arc(x5, 100, 20, 20, 0.52, 5.76); }
  • 10. Designing with Code Let the array store the variables Arrays float[] x = new float[3000]; • this examples shows 3000 variables in an array void setup() { • using repetition loop to work with large arrays keeps the code concise size(240, 120); • need to know the length of the array smooth(); noStroke(); fill(255, 200); for (int i = 0; i < x.length; i++) { x[i] = random(-1000, 200); } } void draw() { background(0); for (int i = 0; i < x.length; i++) { x[i] += 0.5; float y = i * 0.4; arc(x[i], y, 12, 12, 0.52, 5.76); } }
  • 11. that’s it for now .... we will get into this more in the coming classes design and information architecture/ysdn 3006