Archive for the '设计+开发' Category

继续百威项目

星期四, 8月 26th, 2010

本周继续忙着百威的项目。
这个旋转菜单本来想用普通的代码去写,但是没法和酒瓶配合出立体的效果。无奈只好放弃
随后用papervision去写。为了给plane加模糊的滤镜。必须加上下面这句。参照这篇文章以及wonderfl上面的例子

p1.useOwnContainer=true;

这下容易很多。但是在旋转角度方面又碰到了问题。最后得出偶数以及奇数个plane的算法

if(_numImages%2==0){ 
//_numImages为xml文件里面图像的数量
//如果为偶数个,要在原有每个plane的rotationy的基础上加上1/2个角度  
rotateTo = (180/  _numImages)+ (-360/  _numImages)* currentItem*2
}else if(_numImages%2==1){   
rotateTo=  (-360/  _numImages)* currentItem *2
}

symfony的安装技巧(win xp+xampp环境)

星期五, 6月 11th, 2010

symfony最方便的就是通过pear方式安装
1.安装
$ pear channel-discover pear.symfony-project.com
$ pear install symfony/symfony-1.3.5

2.添加到环境变量

3.建立项目

在htdocs下建立myProject文件夹,在cmd窗口里cd到myProject下面执行
$ symfony generate:project myProject
之前的init-project已将废弃不用。
自动会建立一下文件夹
Directory Description
apps/ Hosts all project applications
cache/ The files cached by the framework
config/ The project configuration files
data/ Data files like initial fixtures
lib/ The project libraries and classes
log/ The framework log files
plugins/ The installed plugins
test/ The unit and functional test files
web/ The web root directory (see below)
建立程序
$ symfony generate:app frontend
Directory Description
config/ The application configuration files
lib/ The application libraries and classes
modules/ The application code (MVC)
templates/ The global template files
3.修改httpd.conf文件
用记事本打开这个文件(在apache文件夹下)
在最后一行添加

NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
  ServerName myporject
  DocumentRoot "C:/xampp/htdocs/myProject/web"
  DirectoryIndex index.php
  Alias /sf "C:/pear/data/symfony/web/sf"
  <Directory "C:/xampp/htdocs/myProject/web">
   AllowOverride All
   Allow from All
  </Directory>
  <Directory "C:/pear/data/symfony/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

这里值得注意的是,网上很多人说在php/pear/symfony下面找不到web/sf这些文件夹,其实pear把这些文件安装在c盘下面
4.访问项目
打开浏览器 输入http://127.0.0.1/

出来这个窗口,说明安装成功了。遇到最多的情况就是图片显示不出来,这时候就要回到第三步,检查路径有没有设置对。
输入http://127.0.0.1/frontend_dev.php,这时候调用的是debug模式。

GOOGLE MAP+PAPERVISION

星期一, 3月 15th, 2010

首先从google官方搞到一个SDK,他有flex和flash两个版本的swc,分别考入flash的文件夹内。注意flashcs3和flashcs4的文件夹是不一样的。然后按ctrl+f7,组件列表里面就会出现googlemap的图标,把它拖动到舞台上,然后删除掉,这样它就在你的library里面啦。好,首先我们先try一下直接的应用。

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

package{
 import flash.display.*;
 import flash.net.URLRequest;
 import flash.net.URLLoader;
 import flash.events.*;
 import flash.geom.*;
 import com.google.maps.MapEvent;
 import com.google.maps.Map;
 import com.google.maps.overlays.Marker;
 import com.google.maps.MapType;
 import com.google.maps.LatLng;
 import com.google.maps.LatLngBounds;
 import com.google.maps.controls.MapTypeControl;
 import com.google.maps.controls.ZoomControl;
 import com.google.maps.controls.PositionControl;
 import com.google.maps.controls.MapTypeControlOptions;
 import com.google.maps.controls.ZoomControlOptions;
 import com.google.maps.controls.PositionControlOptions;
 import com.google.maps.controls.ControlPosition;
 import com.google.maps.overlays.Marker;
 import com.google.maps.overlays.MarkerOptions;
 import com.google.maps.MapType;
 import com.google.maps.LatLng;
 import com.google.maps.styles.FillStyle;
 import com.google.maps.styles.StrokeStyle;


 public class contact extends MovieClip {
  public var map:Map;
  public var mapContainer:Sprite;
  public function contact() {
   
   map=new Map();
   map.key="ABQIAAAAhg20Q7yYKzNcG1q8c73SMRTiw-BtopF4xhpGp7qpySedZVuuIBTCAq2k1cZ3VPDsSxYYcUeGYs-pIg";
   map.setSize(new Point(400,400));
   map.x=0
   map.y=0
   map.language="zh-cn";
   map.addEventListener(MapEvent.MAP_READY, onMapReady);
   mapContainer = new Sprite();
   mapContainer.addChild(map);
   addChild(mapContainer);
   

  }



  public function onMapReady(event:Event):void {
   trace("map ready");
   map.setCenter(new LatLng(31.231307277713867,121.46057367324829), 17, MapType.NORMAL_MAP_TYPE);
   //var topLeft:ControlPosition=new ControlPosition(ControlPosition.ANCHOR_TOP_LEFT,20,14);
   //var myZoomControl:ZoomControl=new ZoomControl(new ZoomControlOptions({position:topLeft}));
   //map.addControl(myZoomControl);
   //var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
   //map.addControl(new ZoomControl(),topRight);
   //map.addControl(new PositionControl());
   //map.removeMapType(MapType.HYBRID_MAP_TYPE);
   //map.removeMapType(MapType.PHYSICAL_MAP_TYPE);
   //map.addControl(new MapTypeControl());
   var markerA:Marker = new Marker(
         new LatLng(31.231307277713867,121.46057367324829),
         new MarkerOptions({
                     strokeStyle: new StrokeStyle({color: 0x000000}),
                     fillStyle: new FillStyle({color: 0x00CBFF, alpha: 0.8}),
                     radius: 12,
                     hasShadow: true
         }));
   map.addOverlay(markerA);


  }


 }

}

再来看一下如何应用到papervision中,googlemap不能直接作为材质进行渲染,所以有高人想到了用bitmap.draw的办法,转换为bitmap,再贴到各种形状上,当然,这样的googlemap是不能进行互动的,比如不能缩放,不能拖动。在flash cs4里面,用flash cs4自带的3d api能直接操作google map,这个以后会讨论到. 由于flash的bitmap.draw()有security的限制(adobe的说法是防止远程拷贝机密的档案照片等)。所以在这边无法显示,除非googlemap公布crossdomian的用法。

(Either JavaScript is not active or you are using an old version of Adobe Flash Player. Please install the newest Flash Player.)

package {
 import flash.display.*;
 import flash.events.*;
 import flash.utils.*;
 import flash.filters.*;

 import org.papervision3d.cameras.*;
 import org.papervision3d.materials.*;
 import org.papervision3d.objects.primitives.Cube;
 import org.papervision3d.materials.utils.MaterialsList;
 import org.papervision3d.objects.*;
 import org.papervision3d.scenes.*;
 import org.papervision3d.view.BasicView;

 import com.google.maps.Map;
 import com.google.maps.MapEvent;
 import com.google.maps.MapType;
 import com.google.maps.LatLng;
 import flash.geom.Point;
 import flash.geom.Matrix;
 public class pv3dGoogleMap extends BasicView {
  private var cubeObj:Cube;
  private var planeSize:int=300;
  private var valx:Number=0;
  private var valy:Number=0;
  private var map:Map;
  private var mapContainer:Sprite;
  static public const
  TEXTURE_W:int = 360,   
  TEXTURE_H:int = 360,   
  SCREEN_W:int = 400,   
  SCREEN_H:int = 400;   
  public function pv3dGoogleMap() {
   //初期化
   super();
   init();
   //フレームレート表示
   //showFPS();
  }
  public function init() {
   map=new Map();
   map.key="ABQIAAAAhg20Q7yYKzNcG1q8c73SMRTiw-BtopF4xhpGp7qpySedZVuuIBTCAq2k1cZ3VPDsSxYYcUeGYs-pIg";
   //The Point object represents a location in a
   //two-dimensional coordinate system, where x
   //represents the horizontal axis and y represents the vertical axis.
   //methods and properties of the following classes use Point object
   //Bitmapdata
   //displayobject
   //displayobjectcontainer
   //displacementmapfilter
   //nativewindow
   //matrix
   //rectangle
   map.setSize(new Point(TEXTURE_W,TEXTURE_H));
   map.addEventListener(MapEvent.MAP_READY,function(event:Event):void{;
   //map.setCenter(new LatLng(35.698684,139.774214), 17, MapType.NORMAL_MAP_TYPE);
   map.setCenter(new LatLng(31.231307277713867,121.46057367324829), 17, MapType.NORMAL_MAP_TYPE);
   map.disableDragging();
   });
   mapContainer=new Sprite();
   mapContainer.addChild(map);
   addChild(mapContainer);
   mapContainer.visible=false;
   stage.frameRate=60;
   stage.quality="MEDIUM";
   stage.align=StageAlign.TOP_LEFT;
   
   //this.stage.addEventListener(Event.RESIZE,onStageResize);
   var bmpData:BitmapData=new BitmapData(TEXTURE_W,TEXTURE_H);
   //materiallist
   var ml:MaterialsList=new MaterialsList({
   all:new BitmapMaterial(bmpData),
   front:new BitmapMaterial(bmpData),
   back:new BitmapMaterial(bmpData),
   right:new BitmapMaterial(bmpData),
   left:new BitmapMaterial(bmpData),
   top:new BitmapMaterial(bmpData),
   bottom:new BitmapMaterial(bmpData)
   });
   cubeObj=new Cube(ml,planeSize,planeSize,planeSize,1,1,1);
   cubeObj.material.lineColor=0x00ffffff;
   cubeObj.material.lineAlpha=1;
   scene.addChild(cubeObj);
   cubeObj.rotationX=45;
   cubeObj.rotationY=45;
   var filter:Array=new Array  ;
   filter.push(new DropShadowFilter());
   cubeObj.filters=filter
    camera.zoom=100
   
   startRendering();

  }
  override protected function onRenderTick(event:Event = null):void {
   valx+=mouseX/150;
   valy+=mouseY/150;
   cubeObj.rotationY=valx;
   cubeObj.rotationX=valy;
   cubeObj.material.bitmap.draw(mapContainer);

   super.onRenderTick();
  }
  private function onStageResize(event:Event):void {
   viewport.x=this.stage.stageWidth/2;
   viewport.y=this.stage.stageHeight/2;
  }

 }

}

Schiesser官方网站 - the project

星期三, 2月 10th, 2010

用plane构建了一个场景,没有三维知识的确很难,各种参数调了很久,也没有达到满意的效果。

用sharedobject记录用户喜欢的衣服

估计过完春节,这个网站就能上线了
PS:从上家agency得到的外包项目