javascript rotation

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

javascript rotation

jlm@justinfront.net
Has anyone managed to wrap css rotation for normal html, maybe in a  
haxelib somewhere?  I presume it would be something along the lines  
of...

if( !js.Lib.isIE )
{
Reflect.setField( _style, '-moz-transform', "rotate("+  
Std.string( _angle ) + "deg)" );
}
else
{
//offset?
Reflect.setField( _style, 'filter' +  
"progid:DXImageTransform.Microsoft.BasicImage(rotation =" +  
Std.string( _angle ) + ")";
}

But obviously different...

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: javascript rotation

jlm@justinfront.net
I was thinking maybe there was something like
http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/

I looked inside but could not work out which bits were the guts I need  
to try to move to haXe.

Cheers

;j

On 8 Aug 2011, at 18:00, [hidden email] wrote:

> Has anyone managed to wrap css rotation for normal html, maybe in a  
> haxelib somewhere?  I presume it would be something along the lines  
> of...
>
> if( !js.Lib.isIE )
> {
> Reflect.setField( _style, '-moz-transform', "rotate("+  
> Std.string( _angle ) + "deg)" );
> }
> else
> {
> //offset?
> Reflect.setField( _style, 'filter' +  
> "progid:DXImageTransform.Microsoft.BasicImage(rotation =" +  
> Std.string( _angle ) + ")";
> }
>
> But obviously different...
>
> Cheers
>
> ;j
>
> --
> haXe - an open source web programming language
> http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: javascript rotation

Dion Whitehead Amago
In hydrax: com.pblabs.components.scene2D.js.SceneComponent and the parent class.

If you don't want to use that framework, you should be able to pull
out the relevant bits.

Dion

On Mon, Aug 8, 2011 at 12:14 PM, [hidden email]
<[hidden email]> wrote:

> I was thinking maybe there was something like
> http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/
>
> I looked inside but could not work out which bits were the guts I need to
> try to move to haXe.
>
> Cheers
>
> ;j
>
> On 8 Aug 2011, at 18:00, [hidden email] wrote:
>
>> Has anyone managed to wrap css rotation for normal html, maybe in a
>> haxelib somewhere?  I presume it would be something along the lines of...
>>
>> if( !js.Lib.isIE )
>> {
>> Reflect.setField( _style, '-moz-transform', "rotate("+ Std.string( _angle
>> ) + "deg)" );
>> }
>> else
>> {
>> //offset?
>> Reflect.setField( _style, 'filter' +
>> "progid:DXImageTransform.Microsoft.BasicImage(rotation =" + Std.string(
>> _angle ) + ")";
>> }
>>
>> But obviously different...
>>
>> Cheers
>>
>> ;j
>>
>> --
>> haXe - an open source web programming language
>> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: javascript rotation

jlm@justinfront.net
Don

I could not find all the angle code, but I notice some translation code, writing out 'SceneView.isWebkitBrowser' content used in the if clause, it becomes clear that this library relies on JQuery... 

if (JQuery._static.browser.webkit == true ) {
untyped div.style.webkitTransform = "translate(0px, -" + offsetHeight + "px)";
} else {
untyped div.style.MozTransform = "translate(0px, -" + offsetHeight + "px)";
}

I am trying to avoid overhead/complexity of JQuery, I am assuming it also handles some of the angle code?
Do you have any further suggestions that don't use JQuery.

Cheers

;j


On 8 Aug 2011, at 18:32, Dion Whitehead Amago wrote:

In hydrax: com.pblabs.components.scene2D.js.SceneComponent and the parent class.

If you don't want to use that framework, you should be able to pull
out the relevant bits.

Dion

On Mon, Aug 8, 2011 at 12:14 PM, [hidden email]
<[hidden email]> wrote:
I was thinking maybe there was something like
http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/

I looked inside but could not work out which bits were the guts I need to
try to move to haXe.

Cheers

;j

On 8 Aug 2011, at 18:00, [hidden email] wrote:

Has anyone managed to wrap css rotation for normal html, maybe in a
haxelib somewhere?  I presume it would be something along the lines of...

if( !js.Lib.isIE )
{
Reflect.setField( _style, '-moz-transform', "rotate("+ Std.string( _angle
) + "deg)" );
}
else
{
//offset?
Reflect.setField( _style, 'filter' +
"progid:DXImageTransform.Microsoft.BasicImage(rotation =" + Std.string(
_angle ) + ")";
}

But obviously different...

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: javascript rotation

jlm@justinfront.net
By the way 
untyped _style.MozTransform = "rotate("+ Std.string( _angle ) + "deg)";

works in firefox 


On 8 Aug 2011, at 19:05, [hidden email] wrote:

Don

I could not find all the angle code, but I notice some translation code, writing out 'SceneView.isWebkitBrowser' content used in the if clause, it becomes clear that this library relies on JQuery... 

if (JQuery._static.browser.webkit == true ) {
untyped div.style.webkitTransform = "translate(0px, -" + offsetHeight + "px)";
} else {
untyped div.style.MozTransform = "translate(0px, -" + offsetHeight + "px)";
}

I am trying to avoid overhead/complexity of JQuery, I am assuming it also handles some of the angle code?
Do you have any further suggestions that don't use JQuery.

Cheers

;j


On 8 Aug 2011, at 18:32, Dion Whitehead Amago wrote:

In hydrax: com.pblabs.components.scene2D.js.SceneComponent and the parent class.

If you don't want to use that framework, you should be able to pull
out the relevant bits.

Dion

On Mon, Aug 8, 2011 at 12:14 PM, [hidden email]
<[hidden email]> wrote:
I was thinking maybe there was something like
http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/

I looked inside but could not work out which bits were the guts I need to
try to move to haXe.

Cheers

;j

On 8 Aug 2011, at 18:00, [hidden email] wrote:

Has anyone managed to wrap css rotation for normal html, maybe in a
haxelib somewhere?  I presume it would be something along the lines of...

if( !js.Lib.isIE )
{
Reflect.setField( _style, '-moz-transform', "rotate("+ Std.string( _angle
) + "deg)" );
}
else
{
//offset?
Reflect.setField( _style, 'filter' +
"progid:DXImageTransform.Microsoft.BasicImage(rotation =" + Std.string(
_angle ) + ")";
}

But obviously different...

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: javascript rotation

jlm@justinfront.net
I guess for detection of webkit I can use Franco's code in thx-core
static var _usepage = (~/WebKit/).match(Lib.window.navigator.userAgent);

On 8 Aug 2011, at 19:15, [hidden email] wrote:

By the way 
untyped _style.MozTransform = "rotate("+ Std.string( _angle ) + "deg)";

works in firefox 


On 8 Aug 2011, at 19:05, [hidden email] wrote:

Don

I could not find all the angle code, but I notice some translation code, writing out 'SceneView.isWebkitBrowser' content used in the if clause, it becomes clear that this library relies on JQuery... 

if (JQuery._static.browser.webkit == true ) {
untyped div.style.webkitTransform = "translate(0px, -" + offsetHeight + "px)";
} else {
untyped div.style.MozTransform = "translate(0px, -" + offsetHeight + "px)";
}

I am trying to avoid overhead/complexity of JQuery, I am assuming it also handles some of the angle code?
Do you have any further suggestions that don't use JQuery.

Cheers

;j


On 8 Aug 2011, at 18:32, Dion Whitehead Amago wrote:

In hydrax: com.pblabs.components.scene2D.js.SceneComponent and the parent class.

If you don't want to use that framework, you should be able to pull
out the relevant bits.

Dion

On Mon, Aug 8, 2011 at 12:14 PM, [hidden email]
<[hidden email]> wrote:
I was thinking maybe there was something like
http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/

I looked inside but could not work out which bits were the guts I need to
try to move to haXe.

Cheers

;j

On 8 Aug 2011, at 18:00, [hidden email] wrote:

Has anyone managed to wrap css rotation for normal html, maybe in a
haxelib somewhere?  I presume it would be something along the lines of...

if( !js.Lib.isIE )
{
Reflect.setField( _style, '-moz-transform', "rotate("+ Std.string( _angle
) + "deg)" );
}
else
{
//offset?
Reflect.setField( _style, 'filter' +
"progid:DXImageTransform.Microsoft.BasicImage(rotation =" + Std.string(
_angle ) + ")";
}

But obviously different...

Cheers

;j

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: javascript rotation

Dion Whitehead Amago
In reply to this post by jlm@justinfront.net
You definitely don't need to use Jquery.  I use it since I don't want
to reinvent the wheel in regards to browser detection etc.  And if
you're using a haxe produced js file, even the smallest will be much
bigger than a compress jquery.js file.

The SceneComponents use tranformation matrices for performance, each
frame the x,y, and angle changes are represented by a single matrix,
otherwise you would have to make multiple calls.  But yes, if you
*only* want rotation, then your second reply is the way to do it.

On Mon, Aug 8, 2011 at 1:05 PM, [hidden email] <[hidden email]> wrote:

> Don
> I could not find all the angle code, but I notice some translation code,
> writing out 'SceneView.isWebkitBrowser' content used in the if clause, it
> becomes clear that this library relies on JQuery...
>
> if (JQuery._static.browser.webkit == true ) {
> untyped div.style.webkitTransform = "translate(0px, -" + offsetHeight +
> "px)";
> } else {
> untyped div.style.MozTransform = "translate(0px, -" + offsetHeight +
> "px)";
> }
> I am trying to avoid overhead/complexity of JQuery, I am assuming it also
> handles some of the angle code?
>
> Do you have any further suggestions that don't use JQuery.
> Cheers
> ;j
>
> On 8 Aug 2011, at 18:32, Dion Whitehead Amago wrote:
>
> In hydrax: com.pblabs.components.scene2D.js.SceneComponent and the parent
> class.
>
> If you don't want to use that framework, you should be able to pull
> out the relevant bits.
>
> Dion
>
> On Mon, Aug 8, 2011 at 12:14 PM, [hidden email]
> <[hidden email]> wrote:
>
> I was thinking maybe there was something like
>
> http://www.useragentman.com/blog/2010/03/09/cross-browser-css-transforms-even-in-ie/
>
> I looked inside but could not work out which bits were the guts I need to
>
> try to move to haXe.
>
> Cheers
>
> ;j
>
> On 8 Aug 2011, at 18:00, [hidden email] wrote:
>
> Has anyone managed to wrap css rotation for normal html, maybe in a
>
> haxelib somewhere?  I presume it would be something along the lines of...
>
> if( !js.Lib.isIE )
>
> {
>
> Reflect.setField( _style, '-moz-transform', "rotate("+ Std.string( _angle
>
> ) + "deg)" );
>
> }
>
> else
>
> {
>
> //offset?
>
> Reflect.setField( _style, 'filter' +
>
> "progid:DXImageTransform.Microsoft.BasicImage(rotation =" + Std.string(
>
> _angle ) + ")";
>
> }
>
> But obviously different...
>
> Cheers
>
> ;j
>
> --
>
> haXe - an open source web programming language
>
> http://haxe.org
>
>
> --
>
> haXe - an open source web programming language
>
> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
>
> --
> haXe - an open source web programming language
> http://haxe.org
>

--
haXe - an open source web programming language
http://haxe.org