Outline. 1.! Development Platforms for Multimedia Programming!

Similar documents
Outline. 1.! Development Platforms for Multimedia Programming!

Outline. 1.! Development Platforms for Multimedia Programming!

JavaFX Session Agenda

e(fx)clipse - JavaFX Tooling and Runtime

6! Programming with Images

3 Multimedia Programming with C++ and Multimedia Frameworks

10!Software Engineering Techniques! for Multimedia Software

5 History of Multimedia Programming

Rich Internet Applications

History OOP languages Year Language 1967 Simula Smalltalk

CS 4620 Practicum Programming Assignment 6 Animation

6 Images, Vector Graphics, and Scenes

4 Overview on Approaches to Multimedia Programming

Lab-S : Build a GlassFish JavaFX Monitoring Application using REST monitoring API

An evaluation of JavaFX as 2D game creation tool

Fundamentals of Java Programming

Introduction to JavaFX. Tecniche di Programmazione A.A. 2012/2013

CS506 Web Design and Development Solved Online Quiz No. 01

JavaFX 3D Animation: Bringing Duke to Life

Java SE 6 Update 10. la piattaforma Java per le RIA. Corrado De Bari. Sun Microsystems Italia Spa. Software & Java Ambassador

Cohort: BCA/07B/PT - BCA/06/PT - BCNS/06/FT - BCNS/05/FT - BIS/06/FT - BIS/05/FT - BSE/05/FT - BSE/04/PT-BSE/06/FT

Develop Computer Animation

Master of Sciences in Informatics Engineering Programming Paradigms 2005/2006. Final Examination. January 24 th, 2006

What s next? java@peterbloem.nl

2! Multimedia Programming with! Python and SDL

Android Basics. Xin Yang

Specialized Programme on Web Application Development using Open Source Tools

Introduction to Spark

Jing Yang Spring 2010

ATM Case Study OBJECTIVES Pearson Education, Inc. All rights reserved Pearson Education, Inc. All rights reserved.

ANIMATION a system for animation scene and contents creation, retrieval and display

CompuScholar, Inc. Alignment to Utah's Computer Programming II Standards

<Insert Picture Here> Java, the language for the future

Introducing Windows Workflow Foundation. Building Basic Activities. Building Composite Activities. Activity Development Advanced Features

Creating Scenes and Characters for Virtools in OpenFX

Autoboxing/Autounboxing

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

Outline. CIW Web Design Specialist. Course Content

Creating a 2D Game Engine for Android OS. Introduction

Compositing a 3D character over video footage in Maya Jean-Marc Gauthier, Spring 2008

Animator V2 for DAZ Studio. Reference Manual

University of Twente. A simulation of the Java Virtual Machine using graph grammars

Java 7 Recipes. Freddy Guime. vk» (,\['«** g!p#« Carl Dea. Josh Juneau. John O'Conner

Blender 3D Animation

Lecture 1 Introduction to Android

Teacher: Date: Test: 9_12 Business and IT BD10 - Multimedia and Webpage Design Test 1

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Practical Data Visualization and Virtual Reality. Virtual Reality VR Software and Programming. Karljohan Lundin Palmerius

Overview of the Adobe Flash Professional CS6 workspace

Umbrello UML Modeller Handbook

SE 360 Advances in Software Development Object Oriented Development in Java. Polymorphism. Dr. Senem Kumova Metin

WebObjects Web Applications Programming Guide. (Legacy)

CURRICULUM MAP. Web Design I Mr. Gault

Structural Design Patterns Used in Data Structures Implementation

Realizing Enterprise Integration Patterns in WebSphere

Triggers & Actions 10

COURSE OUTLINE REVISED SPRING 2008

SHAREPOINT 2010 FOUNDATION FOR END USERS

SUMMER SCHOOL ON ADVANCES IN GIS

CS 4204 Computer Graphics

COSC 111: Computer Programming I. Dr. Bowen Hui University of Bri>sh Columbia Okanagan

Glossary of Object Oriented Terms

Anime Studio Debut vs. Pro

Winery A Modeling Tool for TOSCA-based Cloud Applications

Flash MX 2004 Animation Lesson

Lecture 7: Class design for security

JSR-303 Bean Validation

Course Name: Course in JSP Course Code: P5

E-book Tutorial: MPEG-4 and OpenDocument

Mobile App Tutorial Animation with Custom View Class and Animated Object Bouncing and Frame Based Animation

Character Animation Tutorial

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

Wilson Area School District Planned Course Guide

FLASH. Mac versus PC. Pixels versus Vectors Two kinds of images are in the digital world: bitmaps and vectors:

Object Oriented Software Models

Java (12 Weeks) Introduction to Java Programming Language

Video Editing Tools. digital video equipment and editing software, more and more people are able to be

GLEN RIDGE PUBLIC SCHOOLS MATHEMATICS MISSION STATEMENT AND GOALS

To Java SE 8, and Beyond (Plan B)

Java with Eclipse: Setup & Getting Started

Comp 411 Principles of Programming Languages Lecture 34 Semantics of OO Languages. Corky Cartwright Swarat Chaudhuri November 30, 20111

Using Kid Pix Deluxe 3 (Windows)

Computer Graphics 1. Chapter 4 (May 20th, 2010, 2-5pm): The scene graph. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2010

Manual. Programmer's Guide for Java API

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE By using the RETE Algorithm Benefits of RETE Algorithm...

Universität Karlsruhe (TH) Forschungsuniversität gegründet Inheritance Depth as a Cost Factor in Maintenance

Precise and Efficient Garbage Collection in VMKit with MMTk

CHAPTER 6 TEXTURE ANIMATION

Lesson plans Years 5 6

INHERITANCE, SUBTYPING, PROTOTYPES in Object-Oriented Languages. Orlin Grigorov McMaster University CAS 706, Fall 2006

Creative Cloud for Web Design

Web Developer Tutorial: SEO with Drupal: Page Title Module

Java Programming Language

Copyright 2010 Netbriefings, Inc. Page1 agendalayout-wr2010.doc

On line tenders guide

Introduction... Learn to insert event sounds and streaming sounds and to change the effects for a sound... 69

Maya 2014 Basic Animation & The Graph Editor

Flash Tutorial Part I

Transcription:

Outline 1.! Development Platforms for Multimedia Programming! 1.1.! Classification of Development Platforms! 1.2.! A Quick Tour of Various Development Platforms! 2.! Multimedia Programming with Python and Pygame! 2.1.! Introduction to Python! 2.2.! Pygame: A Multimedia/Game Framework for Python! 3.! Multimedia Programming with Java FX! 4.! Multimedia Programming with JavaScript and CreateJS! 5.! History of Multimedia Programming! 6.! Programming with Images! 7.! Programming with Vector Graphics and Animations! 8.! Programming with Sound! 9.! Programming with Video! 10.! Software Engineering Techniques for Multimedia Programs! 10.1.!Design Patterns! 10.2.!Multimedia Modeling Languages! 1

3! Multimedia Programming with JavaFX 3.1! Basic Concepts of JavaFX! 3.2! Observable Properties and Binding! 3.3! Timeline and Animation! 3.4! Interactive JavaFX Applications! Literature:! docs.oracle.com/javafx 2

JavaFX - Idea and History Chris Oliver, 2006 (?): Form follows function (F3)! Working for company SeeBeyond, but personal project! Acquisition of SeeBeyond by Sun, 2005! F3 is not in the center of interest, apparently! First announcement of JavaFX (ex F3) May 2007 (JavaOne conference)! Builds on Java runtime environment:! Common programming model for multimedia applications across many platforms, including mobile devices! In Versions 1.X, JavaFX was built on JavaScript language (not Java!)! JavaFX 2.0 (October 2011): JavaFX as native Java library (and introduction of declarative FXML language)! Since Java SE7 update 6 and JavaFX 2.2: JavaFX contained in Java SE standard distribution! Current version (renumbered): JavaFX 8 (March 2014) 3

JavaFX Application JavaFX program always extends the class! javafx.application.application JavaFX runtime carries out the following steps:! Construct on instance of the application class! Calls init() method (override if needed)! Calls start(javafx.stage.stage) abstract method!» Needs to be overridden! Waits for the application to finish! Calls stop() method (override if needed)! Standard template for a JavaFX application:! public class MyApp extends Application { public void start(stage stage) { 4

JavaFX Stage Stage (Bühne):! Frequently used metaphor for the space for animated program behavior! javafx.stage.stage class:! Top-level container for JavaFX application! Elements are visible/audible only if assigned to stage! Primary stage is constructed by platform (parameter of start())! There may be several stages! Stage has a title! settitle() Stage contents are organized in the contained scene:! setscene(javafx.scene.scene) Stage contents have to be made visible explicitly:! show() 5

JavaFX Scene JavaFX elements are always organized in a scene graph! Frequently used concept also in other platforms! Scene graph is a directed acyclic graph (DAG)! Leaf nodes are media object representations: Rectangle, Text, ImageView, MediaView, Superclass of all contained objects: Node» Composite design pattern, see later! Branching class: Group (extends Node) 6

Skeleton Code for Slideshow in JavaFX public class JFXSlideshowBasic extends Application { @Override public void start(stage primarystage) { Color background = Color.rgb(255,228,95);! final ImageView picture = new ImageView(); picture.setx(50); picture.sety(50); picture.setimage( ); Group root = new Group(picture); Scene scene = new Scene(root, 356, 356, background); primarystage.settitle("simple Slide Show with JavaFX"); primarystage.setscene(scene); primarystage.sizetoscene(); primarystage.show(); 7

QUIZ Give a graphical picture of the scene graph for the code skeleton just shown! 8

3! Multimedia Programming with JavaFX 3.1! Basic Concepts of JavaFX! 3.2! Observable Properties and Binding! 3.3! Timeline and Animation! 3.4! Interactive JavaFX Applications! Literature:! docs.oracle.com/javafx 9

Observable Properties Program variable x depending on the value of another variable y x = f(y)! Example: Bill amount depending on tax rate! Example: Image displayed depending on current index in show! What happens if value of y changes?! If y is a standard variable?! If y is a writable and observable value?! Idea: Re-evaluate x as soon as y changes! Java implementation:! Writable and observable values: Analogous to Java Bean properties! Re-evaluation through Observer pattern: Registering a change listener! More advanced concept: Binding within expressions 10

Example: Observable Property slideindex public class JFXSlideshowBasic extends Application { @Override public void start(stage primarystage) { final ImageView picture = new ImageView(); picture.setimage(imagearray[0]); final IntegerProperty slideindex = new SimpleIntegerProperty(); slideindex.addlistener(new ChangeListener(){ @Override public void changed (ObservableValue o, Object oldval, Object newval){ picture.setimage(imagearray[slideindex.getvalue()]); ); 11

Simple Example for Binding in JavaFX final IntegerProperty propx = new SimpleIntegerProperty(); final IntegerProperty propy = new SimpleIntegerProperty();! propy.bind(propx); propx.setvalue(3); System.out.println ("Value of propy is "+propy.getvalue()); Value of propy is 3 Result: 3 propx propy 12

3! Multimedia Programming with JavaFX 3.1! Basic Concepts of JavaFX! 3.2! Observable Properties and Binding! 3.3! Timeline and Animation! 3.4! Interactive JavaFX Applications! Literature:! docs.oracle.com/javafx 13

Concept: Timeline and Key Frames From JavaFX (Ver. 1!) documentation: Timeline provides the capability to update the property values along the progression of time. Some variables take new values at certain points in time! Example slide index in slide show Timeline: Defines a sequence of key frames Each key frame defines a certain configuration of values Writable property + concrete value for it Each key frame is associated to a point in time Timelines are suitable to express animations Interpolation of values (see later) A timeline is a sequential time container. 14

JavaFX Timeline class Timeline extends Animation Property cyclecount: Repetition counter, may be INDEFINITE! Property KeyFrames: List of KeyFrame objects! Adding key frames to a timeline object:!» By obtaining the keyframe list and adding to that! Main methods for timelines:! play() playfromstart() stop() 15

JavaFX KeyFrame KeyFrame object constructor needs:! Duration object (time in ms from beginning)! KeyValue object! KeyValue object constructor needs:! Writable property (not a normal variable)!» e.g. IntegerProperty, not int Suitable concrete value! E.g.: new KeyFrame( new Duration(8000), new KeyValue(slideindex, 2) ) 16

Example: Timeline for Slideshow Duration!!! 0! 4000! 8000! 16000! 24000 Value for! slideindex!! 0! 1! 2! 3! 4 Timeline timeline = new Timeline(); List<KeyFrame> keyframes = timeline.getkeyframes(); for(int i=0; i<imagearray.length; i++) { keyframes.add( new KeyFrame( new Duration(i*4000), new KeyValue( slideindex, i ) ) ); 17

Slideshow with JavaFX (1) package jfxslideshowbasic;! import java.util.list; import javafx.animation.*; import javafx.application.application; import javafx.beans.property.*; import javafx.beans.value.*; import javafx.scene.*; import javafx.scene.image.*; import javafx.scene.paint.*; import javafx.stage.stage; import javafx.util.duration;! public class JFXSlideshowBasic extends Application { @Override public void start(stage primarystage) {! Color background = Color.rgb(255,228,95); final Image[] imagearray = { new Image("file:pics/tiger.jpg", true), new Image("file:pics/elephant.jpg", true), new Image("file:pics/jbeans.jpg", true), new Image("file:pics/peppers.jpg", true), new Image("file:pics/butterfly.jpg", true), ; 18

Slideshow with JavaFX (2)! final ImageView picture = new ImageView(); picture.setx(50); picture.sety(50); picture.setimage(imagearray[0]); final IntegerProperty slideindex = new SimpleIntegerProperty(); slideindex.addlistener(new ChangeListener(){ @Override public void changed(observablevalue o, Object oldval, Object newval){ picture.setimage(imagearray[slideindex.getvalue()]); ); Group root = new Group(picture); Scene scene = new Scene(root, 356, 356, background); Timeline timeline = new Timeline(); List<KeyFrame> keyframes = timeline.getkeyframes(); for(int i=0; i<imagearray.length; i++) { keyframes.add(new KeyFrame(new Duration(i*4000), new KeyValue(slideindex, i))); primarystage.settitle("simple Slide Show with JavaFX"); primarystage.setscene(scene); primarystage.sizetoscene(); primarystage.show(); timeline.play(); 19

3! Multimedia Programming with JavaFX 3.1! Basic Concepts of JavaFX! 3.2! Observable Properties and Binding! 3.3! Timeline and Animation! 3.4! Interactive JavaFX Applications! Literature:! docs.oracle.com/javafx 20

Slideshow in JavaFX - Interactive Version scene.setonkeypressed(new EventHandler<KeyEvent>() { @Override public void handle(keyevent ke) { int currentslide = slideindex.getvalue(); if (ke.getcode() == KeyCode.RIGHT) { if (currentslide+1 < imagearray.length) { slideindex.setvalue(currentslide+1); if (ke.getcode() == KeyCode.LEFT) { if (currentslide+1 > 0) { slideindex.setvalue(currentslide-1); Using JavaFX Convenience Methods for event handling 21

QUIZ What are the conceptual differences between the Pygame and JavaFX versions of the same program? 22