Visualizzazione dei risultati da 1 a 2 su 2

Discussione: Lente su una foto

  1. #1

    Lente su una foto

    L'effetto che vorrei creare è quello di una lente(una maschera rotonda tracinata dal mouse) mostri un ingrandimento di una foto caricata esternamente.
    Per fare questo ho caricato 2 volte l'immagine...e una l'ho ingrandita e messa sotto la maschera rotonda...
    Il codice è questo..
    codice:
    function zoom() {
        ingrandimento_lente = 4;
        _root.contenitore.gruppo_pulsanti.lente_bottone.onPress = function() {
            unloadMovie(_root.contenitore.foto);
            _root.contenitore.foto.loadMovie(_root.folder+"/01.jpg");
            setProperty(_root.contenitore.foto, _x, 67.5);
            setProperty(_root.contenitore.foto, _y, 0);
            _root.contenitore.foto2.loadMovie(_root.folder+"/01.jpg");
            setProperty(_root.contenitore.foto2, _x, 67.5);
            setProperty(_root.contenitore.foto2, _y, 0);
        };
        _root.contenitore.gruppo_pulsanti.lente_bottone.onRelease = function() {
            altezza = 400;
            lunghezza = ((_root.contenitore.foto2._width*altezza)/_root.contenitore.foto2._height);
            setProperty(_root.contenitore.foto2, _width, lunghezza);
            setProperty(_root.contenitore.foto2, _height, altezza);
            setProperty(_root.contenitore.foto, _width, lunghezza*ingrandimento_lente);
            setProperty(_root.contenitore.foto, _height, altezza*ingrandimento_lente);
            _root.contenitore.maskera.gotoAndStop("lente");
            _root.contenitore.maskera.startDrag(true , _root.contenitore.foto2._x , _root.contenitore.foto2._y , Number(_root.contenitore.foto2._x+_root.contenitore.foto2._width) , Number(_root.contenitore.foto2._y+_root.contenitore.foto2._height));
            trace(_root.contenitore.foto2._x+","+_root.contenitore.foto2._y+","+Number(_root.contenitore.foto2._x+_root.contenitore.foto2._width)+","+Number(_root.contenitore.foto2._y+_root.contenitore.foto2._height));
            _root.contenitore.foto2.onMouseMove = function() {
                point = new object();
                point.x = _root._xmouse;
                point.y = _root._ymouse;
                _root.contenitore.globalToLocal(point);
                trace(point.x+" "+point.y);
                _root.contenitore.foto._x = _root.contenitore.foto2._x-(Number(ingrandimento_lente)*(point.x-_root.contenitore.foto2._x));
                _root.contenitore.foto._y = _root.contenitore.foto2._y-(Number(ingrandimento_lente)*(point.y+_root.contenitore.foto2._y));
                updateAfterEvent();
            };
        };
    }
    Ma non funziona perchè sembra utilizzare le coordinate _x e _y della _root invece di quelle di _root.contenitore (la funzione zoom() l'ho messa in un frame di _root.contenitore)
    Proximus sta arrivando...

  2. #2
    up :quote:
    Proximus sta arrivando...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.