360 degree rotate image mouse drag edge tutorial
360 degree rotate image mouse drag edge tutorial and give edge file
My thoughts would be to, use an event listener for mouse
down.. then depending on where the mouse is down have it create
another event listener for mouse move, for example if the mouse x
and y was in the range of where you want.. And after that in the
mouse move function create a tween depending on where the mouse x
or why moves to.
private function mouseDOWN(evt:MouseEvent):void{
//if mouse x or y is in the position rang wanted, create the
event listener for mouse movement and mouse up.
private function mouseMOVED(evt:MouseEvent):void{
//if mouse y moved from original position, figure out the
difference
// create a tween on the object's original location, and
addition of the difference.
private function mouseUP(evt:MouseEvent):void{
// remove all of the event listeners to stop all
interaction. Also removing the mouse up listener.
hope this helps
Similar Messages
-
I am having issues with 360 degree rotation, I have an iPhone 5 and ios 6.0.2. I have read alot about this issue online and I found out that my issue is software. I want to know if and when apple will fix this issue?
I had the same experience with a new iPhone 5 that I bought last week. Did not have a chance to measure battery life before the 6.0.2 upgrade installed but I set up my phone exactly like my 4S and immediately started running out of power after short periods. Went to Xmas get together with fully charged 5 and 4S. Heading home the iPhone 5 shut down for low battery and the 4S had 65% power. Both phones had two half phone calls on then and no data usage.
That night I fully charged the iPhone 5 and, without lighting it up, put it on my night table. Next morning I picked it up and looked at battery indicator and I had 42% charge with NO activity!
Tried it again next night and wound up with 37% charge. (Slept longer).
Today I called the carrier and reactivated the 4S. Took the 5 to Apple Store and they kindly gave me choice of new replacement phone or refund. I took the refund. Uniquely, the Apple Store said it was Verizon CDMA phones that were coming back.
The are other strings on this with temporary solutions, but from my experience with 7 firmware changes on an HTC 4G phone the problem will continue because the solution will be hardware caused. We are in the days where RTM means Rush to Market - not Release To Manufacturing.
I fear the only solution is to either wait for the next model (I did not notice a really major change in performance over the 4S in LTE heavy Seattle area) - or switch to another manufacturer.
It might be useful for these forums to indicate if you have a GSM or CDMA phone to see which have more problems.
Discouraged.... -
Rotate images with Drag Layer?
Is there any code to allow me to rotate the images that I'm
using with the Dreamweaver Behavior "Drag Layer". I don't mean
rotate as in change images, I mean actually rotating the image by
dragging a selection handle any number of degrees a person wants
to. Just like you can do in image editing programs. Besides being
able to move images on the screen I also want people to be able to
turn the images any way they want .
Thanks.No. You woud have to do the whole thing in Flash to achieve
something like
this.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"rodable" <[email protected]> wrote in
message
news:egrfk2$o8t$[email protected]..
> Is there any code to allow me to rotate the images that
I'm using with the
> Dreamweaver Behavior "Drag Layer". I don't mean rotate
as in change
> images, I
> mean actually rotating the image by dragging a selection
handle any number
> of
> degrees a person wants to. Just like you can do in image
editing programs.
> Besides being able to move images on the screen I also
want people to be
> able
> to turn the images any way they want .
> Thanks.
> -
Hi,
I am trying to implement an application which make the effect of 360 degree rotation. In order to make this effect, i have 72 images of each product which had taken at each 5 degree of the product. The priniciple behind slide show application is using to make this effect. The images are loading sequentially. It works well. But after one full rotation, i am making a reset for 2 variables which handles the index position of current and previous images. I think because of this, a small jerk is feeling after one full rotation. Is there any way to avoid this.
The other problem is that if i make scaling or (x,y) coordinate changing, after one full rotation, a jerk is feeling continously. If i do not make any changes it will work well. Can anybody help me to solve this.
Regards,
SreelashHi, I am attaching the code with this thread. The tool is almost working condition. The problem is I can't align or scale the images. If I make any changes, the rotation will not be smooth. Can you let me know why it's being like this? The rotating tool I have implemented is according to the tool I downloaded from Yofla.com. I am attaching both the fla with this mail.
Regards,
Sreelash -
hi there, hope all you flash guru's can help me out, it's
probably a simple thing but i have never done it before. i am
wanting to create a 360 degrees rotating photo gallery. much like
this one
http://www.pappadums.com/
i have a number of venues for my work that i need to
advertise,. i have the panoramic s almost ready and stiched, but am
wanting to know how to loop them continually like this one in the
website i found. thanks so much for any help.
cheers heathReset to older framework.
-
360 degree panorama spin in Edge Animate (was: 360 degree panorama )
I am trying to create 360 degree panorama. I've got an existing panoramic image made in photoshop which I imported into edge animate.
I need the image move continuously and start over at the beginning seamlessly when the animation gets to the end of the image.
I tried setting action and label to start playing the animation from the beginning but it just jumps back to the beginning and start playing. I need to make the transition between the end and the beginning of the image seamless. Hope you understand what I mean.
Please help.You can use the following simple setup to generate a continuous rotating panorama
FYI: I have used your image for creating the demo
Dropbox - Panorama.zip
Basically,
There is a symbol with overflow set to hidden
There are two instances of the same image .. with name inst1, inst2
inst1 tweens background position from 0- T secs
inst1 tweens 'X' value from T -> T+N secs ( Where N is the overlap time)
inst2 tweens 'X' value from T -> T+N secs
At T+N time, there is a tirgger which restarts the animation -
Drag Moouse to rotate Image Smoothly
I have to write an application look somewhat like igoogle's eyes. When I click onto an image, then every where I drag my mouse, the image will rotate smoothly (does not move, rotate only) to where my mouse position is? Think of an arrow that will rotate to point to wherever my pointer's position is. Can you guy give me some advices on how to accomplish this. Thanks. I do know the basic things, like how to rotate image and how to move object using MouseMotionListener... Thank in advance.
Edited by: yunaeyes on May 20, 2009 5:40 PMimport java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class SpinMe extends JPanel {
BufferedImage image;
double theta = 0;
Point loc = new Point(140,150);
public SpinMe() {
initImage();
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
AffineTransform at =
AffineTransform.getTranslateInstance(loc.x, loc.y);
double cx = image.getWidth()/2.0;
double cy = image.getHeight()/2.0;
at.rotate(theta, cx, cy);
g2.drawRenderedImage(image, at);
private void initImage() {
// make an image
int w = 80;
int h = 30;
int type = BufferedImage.TYPE_INT_RGB;
image = new BufferedImage(w, h, type);
// make an arrow
double cx = w/2.0;
double cy = h/2.0;
double len = w;
double barb = 25.0;
double phi = Math.toRadians(20);
Path2D.Double arrow = new Path2D.Double();
arrow.moveTo(cx-len/2, cy);
arrow.lineTo(cx+len/2, cy);
double theta = Math.PI + phi;
double x = cx+len/2 + barb*Math.cos(theta);
double y = cy + barb*Math.sin(theta);
arrow.lineTo(x, y);
arrow.moveTo(cx+len/2, cy);
theta = Math.PI - phi;
x = cx+len/2 + barb*Math.cos(theta);
y = cy + barb*Math.sin(theta);
arrow.lineTo(x, y);
// draw the arrow into the image
Graphics2D g2 = image.createGraphics();
g2.setBackground(new Color(210,210,240));
g2.clearRect(0,0,w,h);
g2.setPaint(Color.red);
g2.draw(arrow);
g2.dispose();
public static void main(String[] args) {
SpinMe test = new SpinMe();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(test);
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
test.addMouseListener(test.ma);
test.addMouseMotionListener(test.ma);
private double getTheta(Point p) {
Point2D.Double ctr = getCenter();
double dy = p.y - ctr.y;
double dx = p.x - ctr.x;
return Math.atan2(dy, dx);
private Point2D.Double getCenter() {
int iw = image.getWidth();
int ih = image.getHeight();
double cos = Math.abs(Math.cos(theta));
double sin = Math.abs(Math.sin(theta));
double width = iw*cos + ih*sin;
double height = ih*cos + iw*sin;
Point2D.Double p = new Point2D.Double();
p.x = loc.x + width/2;
p.y = loc.y + height/2;
return p;
/** Use MouseInputAdapter for j2se 1.5- */
private MouseAdapter ma = new MouseAdapter() {
double offsetTheta;
public void mousePressed(MouseEvent e) {
offsetTheta = getTheta(e.getPoint()) - theta;
public void mouseDragged(MouseEvent e) {
theta = getTheta(e.getPoint()) - offsetTheta;
repaint();
} -
360 degree image to linear format
Hi, I am trying to convert a 360 degree (Cylindrical) 2d image into a linear 2d strip of image as a part of my masters project. Could any one please tell me a better idea of using java functions to work on image conversions?
Cheers,
AnandThanks Lilybird. I have looked high and low to find an answer so perhaps the simple answer is that it can't be done :-(
My backup plan is to take a screen cast video of myself rotationg the image. Not as good but at least something. -
Why can you no longer rotate 360 degrees within the music app?
Why can you no longer rotate 360 degrees within the music app?
same question...Why can you still not rotate within the music app?!!!???
-
Add 360 degree image in CP55?
Hi,
I use Captivate 5.5 and are planning for an e-learning for my companys' product launch od new products. I recently got access to all our products in 3D images and would like to add 3D images/360 degree images to my project in CP with the intention that the user can click the image and make it twist and turn to make it possible to see it from all directions.
1. Is this possible in Captivate 5.5?
2. How do I successfully insert such an image into my project?
Regards,
JohannaThanks Lilybird. I have looked high and low to find an answer so perhaps the simple answer is that it can't be done :-(
My backup plan is to take a screen cast video of myself rotationg the image. Not as good but at least something. -
Since the latest apple upgrade, words with friends will only rotate 360 degrees
SSince upgrading os7 words with friends will only rotate 360 degrees. Can not get it in the horizontal position
I have the same problem. And not just with WWF. I have a banking app that won't rotate either...
-
My screen will not fully rotate 360 degrees, anyone help.?
My screen will not rotate fully 360 degrees, anyone any ideas?
Frozen or unresponsive iPad
Resolve these most common issues:
• Display remains black or blank
• Touch screen not responding
• Application unexpectedly closes or freezes
http://www.apple.com/support/ipad/assistant/ipad/
iPad Frozen, not responding, how to fix
http://appletoolbox.com/2012/07/ipad-frozen-not-responding-how-to-fix/
iPad Frozen? How to Force Quit an App, Reset or Restart Your iPad
http://ipadacademy.com/2010/11/ipad-frozen-how-to-force-quit-an-app-reset-or-res tart-your-ipad
Black or Blank Screen on iPad or iPhone
http://appletoolbox.com/2012/10/black-or-blank-screen-on-ipad-or-iphone/
What to Do When Your iPad Won't Turn On
http://ipad.about.com/od/iPad_Troubleshooting/ss/What-To-Do-When-Your-Ipad-Wo-No t-Turn-On.htm
iOS: Not responding or does not turn on
http://support.apple.com/kb/TS3281
Home button not working or unresponsive, fix
http://appletoolbox.com/2013/04/home-button-not-working-or-unresponsive-fix/
iPad: Basic troubleshooting
http://support.apple.com/kb/TS3274
Cheers, Tom -
I'm new to Flash and I'm having trouble rotating my mc 360 degrees using the 3D Rotation Tool. I can rotate it 180 degrees, right side coming forward, but when I attempt to rotate it back to its original position, it doesn't continue the rotation in the same direction (right side coming forward). So instead of apearing to rotate completely, it looks like it rotates half way, stops, and rotates back (left side comes forwards).
Probably an easy solution, but as I said, I'm new.
Thanks in advance.Animation apps always choose the fastest way from a->b. You might think starting at 0, setting a keyframe at 180, then another at 0 would mean 'do a full rotation'. However the computer knows going from 180 in reverse back to 0 is faster.
This is the most common rotation issue in any animation app. You need to make sure the 2 points you want to change between are actually the best route from a->b.
For instance if you start at 0, keyframe up to 182, then keyframe to 0, it should rotate properly. 182 wrapping past 360 to 0 is faster than going from 182 in reverse back to 0.
It's easier just to set 3 keyframes usually. 0-120, 120-240, 240-360. That assures you the distance between each keyframe will go in the expected direction (shortest from a->b). -
Rotating images in Address Book??
I am rather confused at the determination of Address Book to store contact photo's on one side??
I have rotated images right round 360 degress but no matter what way up they are once I drag them on to the image frame, address book automatically rotates the image 90 degrees counterclockwise of the right way up???
It is clever how it knows but also very frustrating? Does anybody else have this experience?
Mac Mini connecting iPod Nano + Sony Ericsson K810i Mac OS X (10.4.8)Hi Wesley,
Welcome to Apple Discussions
Are you saying that Address Book takes an perfectly good upright image and rotates it 90 degrees CCW?
I am a little confused by your statement.."It is clever how it knows but also very frustrating?"
What program are you using to edit/rotate your images?
Regards,
John -
Mouse dragged event with unexpected coordinates
I am dragging the mouse on a half circle from the middle left to the top middle. This results in mouse events with the coordinates form (10,90) ->(100,10)
Letting the mouse go and then dragging it further to the left, the coordinates in the of the event are similar than the starting point of the first mouse drag event.
Can anyone shed some light on this peculiar behavior?First of, I have to apologize for the example not being as minimalistic as it might be, but on the plus side, I know now why this happens, I just don't know how to work around it.
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
package javafxtest;
import java.util.ArrayList;
import javafx.application.Application;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Dimension2D;
import javafx.geometry.Point2D;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.scene.transform.Rotate;
import javafx.stage.Stage;
* @author andi
public class HandleRotation extends Application {
private DoubleProperty currentRotation;
private ArrayList<Double> angles;
@Override
public void start(Stage primaryStage) {
currentRotation = new SimpleDoubleProperty(this, "currentRotation", 10);
SteeringWheelGroup background = new SteeringWheelGroup(200);
background.setManaged(false);
Group g = new Group(background);
final Point2D centerPoint = new Point2D(100, 100);
angles = new ArrayList<>(3);
angles.add(190.0);
angles.add(270.0);
angles.add(350.0);
double step = (180.0 - 2 * currentRotation.doubleValue()) / (angles.size() - 1);
int radius = 100;
final int yTranslation = 15; // might be due to the labels
Polygon handle = createHandle(centerPoint, radius, yTranslation);
g.getChildren().add(handle);
StackPane root = new StackPane();
Scene scene = new Scene(g, 300, 250);
primaryStage.setTitle("Handle Rotation!");
primaryStage.setScene(scene);
primaryStage.show();
* Calculate the base point for the label. This is the point on the arc, matching the angle.
* @param center point of the circle
* @param radius radius of the circle
* @param angle in degree in [0,180]
* @return Point on the circle
Point2D calculateBasePoint(Point2D center, double radius,
double angle) {
float newX = (float) (center.getX() + radius * Math.cos(Math.toRadians(angle)));
float newY = (float) (center.getY() + radius * Math.sin(Math.toRadians(angle)));
return new Point2D(newX, newY);
* Create the polygon that represents the handle
* @param centerPoint
* @param radius
* @return
private Polygon createHandle(final Point2D centerPoint, int radius, final int yTranslation) {
double baseAngle = 180;
Point2D p1 = calculateBasePoint(centerPoint, radius, baseAngle - 5);
Point2D p2 = calculateBasePoint(centerPoint, radius, baseAngle + 2);
Point2D p3 = calculateBasePoint(centerPoint, radius*0.65, baseAngle + 2);
Point2D p4 = calculateBasePoint(centerPoint, radius*0.65, baseAngle - 7);
double[] points = {p1.getX(), p1.getY(), p2.getX(), p2.getY(), p3.getX(), p3.getY(), p4.getX(), p4.getY()};
Polygon polygon = new Polygon(points);
// polygon.setOpacity(0);
polygon.setTranslateY(-yTranslation);
final Rotate rotationTransform = new Rotate(currentRotation.doubleValue(), centerPoint.getX(), centerPoint.getY());
polygon.getTransforms().add(rotationTransform);
polygon.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
if (event.getY() < centerPoint.getY()) {
System.out.println("Event: "+event);
Point2D point = new Point2D((float)event.getX(), (float)event.getY());
double newAngle = angleBetween2Lines(centerPoint, point);
if (newAngle < 0) {
newAngle = (90 + newAngle)+ 90;
System.out.println("Set angle on mouse drag: "+newAngle);
if (newAngle < 10) {
newAngle = 10;
if (newAngle > 170) {
newAngle = 170;
currentRotation.set(newAngle);
polygon.setOnMouseReleased(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
snapToNearestAngle();
rotationTransform.setAngle(currentRotation.doubleValue());
return polygon;
* Snap to the correct angle. Correct angle is angle belonging to the nearest label.
void snapToNearestAngle() {
double currentAngle = currentRotation.doubleValue() + 180;
double currentMin = 360;
int minIndex = 0;
System.out.println("Current rotation is "+currentAngle);
for (int i = 0; i < angles.size(); i++) {
double angle = angles.get(i);
double diff = Math.abs(angle - currentAngle);
if (diff < currentMin) {
currentMin = diff;
minIndex = i;
System.out.println("new minDifference at "+i+": "+diff);
Double destinationAngle = angles.get(minIndex);
System.out.println("DestinationAngle is "+currentAngle+" -> "+(destinationAngle - 180));
if (destinationAngle < 180 + 10 || destinationAngle > 360 - 10) {
throw new IllegalStateException("Angle is out of range: "+currentRotation.doubleValue()+" -> "+destinationAngle);
currentRotation.set(destinationAngle - 180);
* Calculate the angle between the vector horizontally to the left from the center
* and the current point.
* @param center point
* @param point current point
* @return angle in degree
double angleBetween2Lines(Point2D center, Point2D point) {
double slope2 = calculateSlope(center, point);
double angle = Math.atan(slope2);
if (point.getX() > center.getX()) {
angle += Math.PI/2;
System.out.println("Slope: "+slope2+" angle "+Math.toDegrees(angle));
return Math.abs(Math.toDegrees(angle));
* Caluculate the slope of the line defined by two points.
* The first point is the center of a circle and the second
* point roughly lies on the circle.
* @param center point
* @param point on the circle
* @return slope of the connecting line.
double calculateSlope(Point2D center, Point2D point) {
System.out.println("center="+center+",point="+point);
double absSlope = Math.abs((point.getY() - center.getY()) / (point.getX() - center.getX()));
if (point.getY() > center.getY()) {
if (point.getX() > center.getX()) {
// bottom right
return -absSlope;
} else {
// bottom left
return absSlope;
} else {
if (point.getX() > center.getX()) {
// top right
return absSlope;
} else {
// top left
return -absSlope;
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
* @param args the command line arguments
public static void main(String[] args) {
launch(args);
private class SteeringWheelGroup extends Group {
public SteeringWheelGroup(int destinationWidth) {
int topPadding = 0;
Rectangle rect = new Rectangle(getImageWidth(), getImageWidth(), Color.RED);
double scale = destinationWidth / rect.getWidth();
rect.setScaleX(scale);
rect.setScaleY(scale);
Circle circle = new Circle(getImageWidth()/2, getImageWidth()/2, getImageWidth()/2, Color.BLUE);
circle.setScaleX(scale);
circle.setScaleY(scale);
Group rotationGroup = new Group(/*rect,*/ circle);
rotationGroup.setManaged(false);
int width = getImageWidth();
Rectangle clipRectangle = new Rectangle(0, 0, width, width / 2);
Circle clipCircle = new Circle(width / 2, width / 2, width / 2);
Shape clip = Shape.intersect(clipRectangle, clipCircle);
rotationGroup.setClip(clip);
this.getChildren().add(rotationGroup);
//double h = calculateHeigthOverHorizon(angle, destinationWidth/2);
//setTranslateY(-h+topPadding);
public final int getImageWidth() {
return 479;
Here is how you can reproduce my effect:
Grab the black handle
Drag the mouse top and right until you approach the angle -90 (have an eye out on the console log)
Let the mouse go: the handle will snap to 90 degree
Grab the handle a second time and move further right
You will see that the angle printed out do not match what you expect.
Let the mouse go, the Handle snaps back to it's original position
As the rotation does not happen around the polygon's center, I have to use a Rotaion effect, which is applied. While I can drag the shape from the rotated location the dragging is always measured from its base position.
So what can I do to work around this?
final Rotate rotationTransform = new Rotate(currentRotation.doubleValue(), centerPoint.getX(), centerPoint.getY());
polygon.getTransforms().add(rotationTransform);
If worse comes to worst, I can use a circular handle covering everything, then I can rotate around its center, but I would like to avoid this.
Maybe you are looking for
-
Lookup in array literal?
Hello, Does Java support lookups from array literals? Something like this: System.out.println(["one", "two", "three"][1]); // outputs "two"Yeah I know it's bad practice, I'm just messing around with some obfuscated code. Thanks, Z.
-
Apple Users Can't Get Rid Of The New 'Super Cookies' That Track Private Web Browsing
Further to the article "Apple Users Can't Get Rid Of The New ‘Super Cookies’ That Track Private Web Browsing" https://ca.finance.yahoo.com/news/apple-users-cant-rid-super-180500863.html, is there a solution to resolve this security issue? Here's an e
-
Dear Support, Is there a possibility to switch off in Firefox the functionality of quick launch key (additional key in laptop) that cause to run the homepage. I would like to switch this functionality off, because the key is malfunctioned and always
-
Euro symbol appearing as "#"
Hello, When I view the output preview of the <u>Purchase Order (SmartForms) layout</u> ... the symbol for the <b>Euro currency</b> is <u>not</u> displayed correctly and appears rather as the character "<b>#</b>". How can I fix this?? Thanks, Tim
-
Hi I have large database and i need to perform batch deleting without affecting the transaction log. So if I set the Recovery mode to Simple before deleting the transaction log will not grow ?? Thanks.