SlideShare una empresa de Scribd logo
1 de 3
Descargar para leer sin conexión
66                                                                      Technique



      Flash CS3 or later
        Create
      organic
      3D ribbon
      effects
          Go with the flow to
      generate a series of
      stunning, colourful Flash
      patterns, writes Stewart
      Hamilton-Arrandale
                   Free-flowing ribbon effects have been given a fresh
      lease of life through ActionScript 3.0, enabling designers to create
      organic effects that react to user interaction and display as clear,
      crisp and bright colour ribbons. Dozens of online and TV-based ad
      campaigns have been reintroducing these elements to sell
      everything from cars to PCs, so it’s a trend on the rise and a skill
      worth having in your tool box.
                   In this tutorial I’ll be showing you how to create these
      organic ribbon visuals using some of Flash Player 10’s new drawing
      functions – but nothing we’ll be doing will be Flash Player 10
      specific. I’ve set up the parameters already, and we’ll run through
      them, explaining what each does, so that you can use the files as a
      template for creating your own ribbon effects (and at the same time
      learn some of the new data types and the new improved drawing
      API in Flash Player 10).




      Stewart Hamilton-       On the disc              Time needed
      Arrandale
         The award-
                              The files you need to
                              complete this
                                                       1 hour
                                                                                          01          Copy the disc files
      winning freelance       tutorial can be found    Skills
                                                                                          to your computer and open
      digital designer has    in DiscContents             ActionScript                   the Step 1 folder. Test the
      produced Flash          ResourcesRibbon             animations                     Flash file to check everything
      solutions for the                                    Basic                          is working. You’ll notice in the
      likes of Crown paints                                ActionScript 3.0
      and Original Source,
                                                                                          Properties panel that I have
                                                           Use of Flash                   linked the CA_Ribbons class
      and delivered motion                                 graphics
      graphics pieces for                                                                 to the Flash file, and have set
      Liverpool Capital of                                                                everything up for you.
      Culture ‘08. To find
      out more see www.
      creativewax.co.uk




      Computer Arts December 2009                                                              www.computerarts.co.uk




ART169.tut_flash 66                                                                                                21/10/09 10:12:16 am
67




                                                                                                            03         Now open the Ribbons.as from the same folder.
                                                                                                            You can see all our variable declarations on lines 8-37. The
          02         Take a look at the RibbonParticle class in the comcreativewaxribbons                 particles:Vector<RibbonParticle> line is an Array that only
          folder. You’ll notice that this is a very simple class, the sole purpose of which is to act       excepts the data type we specify, while __drawCommands and
          as a pointer to a virtual position, storing a few variables to let the ribbon system know         __drawCoords are two vectors that are used via the new
          how to draw the ribbons.                                                                          drawing commands in Flash 10.




                                                           05          In the moveParticles method, we set a reference      06         In the drawRibbon method, we loop
                                                           to the first particle in our ribbon and then update its          through the all the particles and get a
                                                           position closer to the sprite it’s following. We then loop       reference to the current particle. Calculate the
                                                           through the rest of the particles and add forces and friction    midpoint of the ribbon by finding the halfway
                                                           to its velocity, updating its X and Y positions. Then we check   value between the first and last virtual points.
                                                           the distance between the current particle and the one            Next, add the drawing point values to the
                                                           before it.                                                       __drawCoords vector, then draw this ribbon
          04         In the Constructor, set the                                                                            segment out.
          variables and initialise the
          __drawCommands vector. The
          createParticles method loops through
          the maximum amount of particles set
          and then creates them. We can also
          increment the radius of the particles
          and then store a reference in our
          particles vector. Below this is the render
          method that moves the particles and
          then draws around them to create the
          ribbon effect.




                            Go bite-sized
                             When faced with a
                 coding problem that seems too
                 big to tackle, always try to break
                                                                                                                            08        The next method – setMidPoints
                                                                                                                            – sets a point at a position based halfway
                 it down into smaller, logical
                 parts that are more manageable.           07         In setRadiusPoints method, we work out two            between the two points passed in Steps 1 and
                 This way, even the most difficult         virtual points around the particle passed in. This is based      2. Between the information generated in this
                 tasks are easily accomplished.            on the particle’s virtual radius and its current angle, which    and the setRadiusPoints methods, we now
                                                           is offset by the pAngle variable we set up. We end up with       have enough data to draw the current ribbon
                                                           two virtual points both sitting at 90-degree offsets.            segment with a nice flowing curve.



          www.computerarts.co.uk                                                                                                             Computer Arts December 2009




ART169.tut_flash 67                                                                                                                                              21/10/09 10:12:17 am
68




                                                                10         When we repeat Step 1 we          11          Next in createRibbons, we loop through
                                                                see a vector holding the Ribbon classes      the __total variable to create our ribbons. For this
      09          CheckParticleDistance sets the distance       we have created. In the Constructor,         tutorial I have set up random parameters for the
      and angle between two particles. If the distance is       call the __resize method to set the          ribbons. When creating the ribbon, I have set its start
      greater than the maximum value we set earlier, the        stage width and height variables,            position off stage and then stored a reference to it in
      particle is repositioned based on its neighbour’s         create the ribbons, set up the Timer to      the __ribbons vector to add it to the display.
      position and angle. Set the velocity and tolerance        once every 30th of a second, and add
      quite high to give the ribbons an elastic feel.           the main sprite to the display.




      12        The final methods are very simple. The render
      method updates the fake camera movement and ribbons;
      moveCamera updates the forces that are supplied to the
      ribbons, and updates the __follower sprite position based on        13         Now look at the CA_Ribbons.as file in the Final folder. You’ll notice a couple
      the mouse position; updateRibbons applies the new forces to         of variables: getRandomPoint is called in the Constructor and uses the TweenMax
      each ribbon before rendering; and the resize method updates         class to animate the __follower sprite to a random position on a Bezier curve, creating
      the stage width and height references.                              the ribbon effect.




                                                                                                  15         Open and export the CA_Ribbons.fla to test it. Now
                                                                                                  we’ve run through the file, have a mess around with the
                                                                                                  parameters on the ribbons to create your own. By tweaking the
                                                                                                  code slightly you could turn the ribbons into a music visualiser or
                                                                                                  even add multiple follower sprites. Have fun experimenting!
      14        The last update is the moveCamera method, which tracks the position of the
      __follower sprite. Forces are worked out with the difference between the __follower’s
      current and previous positions, and then the previous position point is updated to
      generate the random ribbon effects.



      Computer Arts December 2009                                                                                                           www.computerarts.co.uk




ART169.tut_flash 68                                                                                                                                           21/10/09 10:12:19 am

Más contenido relacionado

Similar a Create organic 3D ribbon effects in Flash CS3 or later

Neural network image recognition
Neural network image recognitionNeural network image recognition
Neural network image recognitionOleksii Sekundant
 
Designing a neural network architecture for image recognition
Designing a neural network architecture for image recognitionDesigning a neural network architecture for image recognition
Designing a neural network architecture for image recognitionShandukaniVhulondo
 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteDr Nic Williams
 
Productive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam PenroseProductive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam PenroseDatabricks
 
Problem cruncher 20160803
Problem cruncher 20160803Problem cruncher 20160803
Problem cruncher 20160803Sharon Liu
 
C# classes
C#   classesC#   classes
C# classesTiago
 
A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...
A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...
A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...ricky_pi_tercios
 
SCons an Introduction
SCons an IntroductionSCons an Introduction
SCons an Introductionslantsixgames
 
Quantum. Just Quantum
Quantum. Just QuantumQuantum. Just Quantum
Quantum. Just QuantumElifTech
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialpotaters
 
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingPART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingFastBit Embedded Brain Academy
 
Key projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AIKey projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AIVijayananda Mohire
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labsccis224477
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4Richard Jones
 
A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...
A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...
A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...IRJET Journal
 

Similar a Create organic 3D ribbon effects in Flash CS3 or later (20)

Neural network image recognition
Neural network image recognitionNeural network image recognition
Neural network image recognition
 
Designing a neural network architecture for image recognition
Designing a neural network architecture for image recognitionDesigning a neural network architecture for image recognition
Designing a neural network architecture for image recognition
 
Canvas教程
Canvas教程Canvas教程
Canvas教程
 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - Keynote
 
Productive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam PenroseProductive Use of the Apache Spark Prompt with Sam Penrose
Productive Use of the Apache Spark Prompt with Sam Penrose
 
Problem cruncher 20160803
Problem cruncher 20160803Problem cruncher 20160803
Problem cruncher 20160803
 
C# classes
C#   classesC#   classes
C# classes
 
A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...
A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...
A Methodology for the Emulation of Boolean Logic that Paved the Way for the S...
 
SCons an Introduction
SCons an IntroductionSCons an Introduction
SCons an Introduction
 
Quantum. Just Quantum
Quantum. Just QuantumQuantum. Just Quantum
Quantum. Just Quantum
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorial
 
Tensor flow
Tensor flowTensor flow
Tensor flow
 
Vectors Intro.ppt
Vectors Intro.pptVectors Intro.ppt
Vectors Intro.ppt
 
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with DebuggingPART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
PART-3 : Mastering RTOS FreeRTOS and STM32Fx with Debugging
 
Som paper1.doc
Som paper1.docSom paper1.doc
Som paper1.doc
 
Key projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AIKey projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AI
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
What's New In Python 2.4
What's New In Python 2.4What's New In Python 2.4
What's New In Python 2.4
 
A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...
A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...
A Pointing Gesture-based Signal to Text Communication System Using OpenCV in ...
 

Más de Márcio Antônio Moraes Reyes

Más de Márcio Antônio Moraes Reyes (20)

Criptografia_Métodos_E_Tecnicas_Criptograficas.ppt
Criptografia_Métodos_E_Tecnicas_Criptograficas.pptCriptografia_Métodos_E_Tecnicas_Criptograficas.ppt
Criptografia_Métodos_E_Tecnicas_Criptograficas.ppt
 
Introdução
IntroduçãoIntrodução
Introdução
 
Instalação elétrica
Instalação elétricaInstalação elétrica
Instalação elétrica
 
Trabalho tribal01.svg
Trabalho tribal01.svgTrabalho tribal01.svg
Trabalho tribal01.svg
 
3dxp_programming
3dxp_programming3dxp_programming
3dxp_programming
 
67580196-receitas
67580196-receitas67580196-receitas
67580196-receitas
 
4490170-Arabic-Cooking-Recipes
4490170-Arabic-Cooking-Recipes4490170-Arabic-Cooking-Recipes
4490170-Arabic-Cooking-Recipes
 
Fluxo Menus Editáveis
Fluxo Menus EditáveisFluxo Menus Editáveis
Fluxo Menus Editáveis
 
acordes y escalas para guitarra
acordes y escalas para guitarraacordes y escalas para guitarra
acordes y escalas para guitarra
 
Joan_Baez-Diamonds_And_Rust
Joan_Baez-Diamonds_And_RustJoan_Baez-Diamonds_And_Rust
Joan_Baez-Diamonds_And_Rust
 
3106741-MySQLStoredProcedures
3106741-MySQLStoredProcedures3106741-MySQLStoredProcedures
3106741-MySQLStoredProcedures
 
FINNISH GRAMMAR
FINNISH GRAMMARFINNISH GRAMMAR
FINNISH GRAMMAR
 
br-ficha-inscripcion-beca-odp
br-ficha-inscripcion-beca-odpbr-ficha-inscripcion-beca-odp
br-ficha-inscripcion-beca-odp
 
Documento sem título
Documento sem títuloDocumento sem título
Documento sem título
 
19321927-MySQL-and-Java
19321927-MySQL-and-Java19321927-MySQL-and-Java
19321927-MySQL-and-Java
 
4488990-IndianRecipes
4488990-IndianRecipes4488990-IndianRecipes
4488990-IndianRecipes
 
Escalas de Blues GUITARRA
Escalas de Blues GUITARRAEscalas de Blues GUITARRA
Escalas de Blues GUITARRA
 
Finnish Conversation
Finnish ConversationFinnish Conversation
Finnish Conversation
 
Grafica do Senado.odt
Grafica do Senado.odtGrafica do Senado.odt
Grafica do Senado.odt
 
Mini Curso de Piano - Metodo Frances de Piano
Mini Curso de Piano - Metodo Frances de PianoMini Curso de Piano - Metodo Frances de Piano
Mini Curso de Piano - Metodo Frances de Piano
 

Último

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Último (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Create organic 3D ribbon effects in Flash CS3 or later

  • 1. 66 Technique Flash CS3 or later Create organic 3D ribbon effects Go with the flow to generate a series of stunning, colourful Flash patterns, writes Stewart Hamilton-Arrandale Free-flowing ribbon effects have been given a fresh lease of life through ActionScript 3.0, enabling designers to create organic effects that react to user interaction and display as clear, crisp and bright colour ribbons. Dozens of online and TV-based ad campaigns have been reintroducing these elements to sell everything from cars to PCs, so it’s a trend on the rise and a skill worth having in your tool box. In this tutorial I’ll be showing you how to create these organic ribbon visuals using some of Flash Player 10’s new drawing functions – but nothing we’ll be doing will be Flash Player 10 specific. I’ve set up the parameters already, and we’ll run through them, explaining what each does, so that you can use the files as a template for creating your own ribbon effects (and at the same time learn some of the new data types and the new improved drawing API in Flash Player 10). Stewart Hamilton- On the disc Time needed Arrandale The award- The files you need to complete this 1 hour 01 Copy the disc files winning freelance tutorial can be found Skills to your computer and open digital designer has in DiscContents ActionScript the Step 1 folder. Test the produced Flash ResourcesRibbon animations Flash file to check everything solutions for the Basic is working. You’ll notice in the likes of Crown paints ActionScript 3.0 and Original Source, Properties panel that I have Use of Flash linked the CA_Ribbons class and delivered motion graphics graphics pieces for to the Flash file, and have set Liverpool Capital of everything up for you. Culture ‘08. To find out more see www. creativewax.co.uk Computer Arts December 2009 www.computerarts.co.uk ART169.tut_flash 66 21/10/09 10:12:16 am
  • 2. 67 03 Now open the Ribbons.as from the same folder. You can see all our variable declarations on lines 8-37. The 02 Take a look at the RibbonParticle class in the comcreativewaxribbons particles:Vector<RibbonParticle> line is an Array that only folder. You’ll notice that this is a very simple class, the sole purpose of which is to act excepts the data type we specify, while __drawCommands and as a pointer to a virtual position, storing a few variables to let the ribbon system know __drawCoords are two vectors that are used via the new how to draw the ribbons. drawing commands in Flash 10. 05 In the moveParticles method, we set a reference 06 In the drawRibbon method, we loop to the first particle in our ribbon and then update its through the all the particles and get a position closer to the sprite it’s following. We then loop reference to the current particle. Calculate the through the rest of the particles and add forces and friction midpoint of the ribbon by finding the halfway to its velocity, updating its X and Y positions. Then we check value between the first and last virtual points. the distance between the current particle and the one Next, add the drawing point values to the before it. __drawCoords vector, then draw this ribbon 04 In the Constructor, set the segment out. variables and initialise the __drawCommands vector. The createParticles method loops through the maximum amount of particles set and then creates them. We can also increment the radius of the particles and then store a reference in our particles vector. Below this is the render method that moves the particles and then draws around them to create the ribbon effect. Go bite-sized When faced with a coding problem that seems too big to tackle, always try to break 08 The next method – setMidPoints – sets a point at a position based halfway it down into smaller, logical parts that are more manageable. 07 In setRadiusPoints method, we work out two between the two points passed in Steps 1 and This way, even the most difficult virtual points around the particle passed in. This is based 2. Between the information generated in this tasks are easily accomplished. on the particle’s virtual radius and its current angle, which and the setRadiusPoints methods, we now is offset by the pAngle variable we set up. We end up with have enough data to draw the current ribbon two virtual points both sitting at 90-degree offsets. segment with a nice flowing curve. www.computerarts.co.uk Computer Arts December 2009 ART169.tut_flash 67 21/10/09 10:12:17 am
  • 3. 68 10 When we repeat Step 1 we 11 Next in createRibbons, we loop through see a vector holding the Ribbon classes the __total variable to create our ribbons. For this 09 CheckParticleDistance sets the distance we have created. In the Constructor, tutorial I have set up random parameters for the and angle between two particles. If the distance is call the __resize method to set the ribbons. When creating the ribbon, I have set its start greater than the maximum value we set earlier, the stage width and height variables, position off stage and then stored a reference to it in particle is repositioned based on its neighbour’s create the ribbons, set up the Timer to the __ribbons vector to add it to the display. position and angle. Set the velocity and tolerance once every 30th of a second, and add quite high to give the ribbons an elastic feel. the main sprite to the display. 12 The final methods are very simple. The render method updates the fake camera movement and ribbons; moveCamera updates the forces that are supplied to the ribbons, and updates the __follower sprite position based on 13 Now look at the CA_Ribbons.as file in the Final folder. You’ll notice a couple the mouse position; updateRibbons applies the new forces to of variables: getRandomPoint is called in the Constructor and uses the TweenMax each ribbon before rendering; and the resize method updates class to animate the __follower sprite to a random position on a Bezier curve, creating the stage width and height references. the ribbon effect. 15 Open and export the CA_Ribbons.fla to test it. Now we’ve run through the file, have a mess around with the parameters on the ribbons to create your own. By tweaking the code slightly you could turn the ribbons into a music visualiser or even add multiple follower sprites. Have fun experimenting! 14 The last update is the moveCamera method, which tracks the position of the __follower sprite. Forces are worked out with the difference between the __follower’s current and previous positions, and then the previous position point is updated to generate the random ribbon effects. Computer Arts December 2009 www.computerarts.co.uk ART169.tut_flash 68 21/10/09 10:12:19 am