Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JavaScript Weirdness



The following JavaScript code takes as input
a slider value in the range 0.0 to 1.0
an image height (in pixels)
and the image's aspect ratio

It is meant to output a whole number to the CellHeight
output
and that number multiplied by the aspect ratio at the
CellWidth output.

Instead, what I get is the correct value at the Width
output, but the CellHeight output always shows a zero.
This is actually the same issue I was having with the
code in my previous post.

Can someone tell me if this is a JavaScript patch bug,
or if I'm missing something obvious?
It seems that it is possible to define multiple named
inputs of the same type, but can someone confirm
whether or not it is possible to define multiple named
outputs in the same way?

If not, why not, I wonder? It would seem to be a
desirable thing to do..

Cheers,

alx
http://www.toneburst.net


/* JAVASCRIPT PATCH CODE */

// Define function, inputs and outputs
function
(__number CellWidth,
__number CellHeight
) main (
__number CellSizeSlider,
__number Height,
__number AspectRatio
)

{
	// Initialise output object
	var result = new Object();
	// Reverse slider value
	cellSize = 1.0 - CellSizeSlider;
	// Output width as whole-number division of Height
	
	cellHeight = Math.floor(cellSize * Height);
	cellWidth = cellHeight * AspectRatio
	
	result.CellWidth = cellWidth;
	result.CellHeight = cellHeight;
	
	// Output values
	return result;
}



      ___________________________________________________________ 
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good  http://uk.promotions.yahoo.com/forgood/environment.html
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: QCPlugin and Consumer sub patches (From: Christopher Wright <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.