Away3D Lite:Basic_SceneSetup

本文介绍了一个简单的3D场景构建过程,并演示了如何通过调整平面对象的属性来实现旋转动画效果。代码示例中涵盖了场景、相机、视图等核心组件的创建及配置方法。
scene = new Scene3D();

// 亦可添加参数:camera = new Camera3D({z:-1000});
camera = new Camera3D();
camera.z = -1000;

// 亦可添加参数:view = new View3D({scene:scene, camera:camera});
view = new View3D();
view.scene = scene;
view.camera = camera;

//view.addSourceURL("srcview/index.html");
addChild(view);

//plane = new Plane({material:material, width:500, height:500, yUp:false, bothsides:true});
plane = new Plane();
plane.material = material;
plane.width = 500;
plane.height = 500;
plane.yUp = false;
plane.bothsides = true;

scene.addChild(plane);
 
private function onEnterFrame( e:Event ):void
{
	plane.rotationY += 2;
	
	view.render();
}

 

几乎就是PV3D的翻版 嘛。。。

PS:最可怜的是在家里无法访问away的官方博客,GFW啊。。。只能在公司的时候多看看了。。。


<fragment android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" app:navGraph="@navigation/nav_graph" app:defaultNavHost="true" />如果放在<!--隐藏bottomsheet--> <LinearLayout android:id="@+id/ll_bottom_sheet" android:layout_width="match_parent" android:layout_height="wrap_content" app:behavior_peekHeight="105dp" app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <ImageView android:id="@+id/pull" android:layout_width="match_parent" android:layout_height="30dp" android:background="@color/white" android:clickable="false" android:focusable="false" android:gravity="center" android:paddingTop="15dp" android:src="@drawable/pullselector" /> <LinearLayout android:layout_width="match_parent" android:layout_height="60dp" android:layout_gravity="center_horizontal" android:background="@color/white" android:paddingStart="10dp" android:paddingTop="10dp" android:paddingEnd="10dp" android:weightSum="4"> <ImageButton android:id="@+id/button_mode" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/mode" /> <ImageButton android:id="@+id/button_schedule" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/schedule" /> <ImageButton android:id="@+id/button_away" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/away" /> <ImageButton android:id="@+id/button_timer" android:layout_width="0dp" android:layout_height="60dp" android:layout_weight="1" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/timer" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="42dp" android:layout_gravity="center_horizontal" android:background="@color/white" android:paddingStart="10dp" android:paddingEnd="10dp" android:weightSum="4"> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Mode" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Schedule" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Away" /> <TextView android:layout_width="0dp" android:layout_height="42dp" android:layout_weight="1" android:gravity="center" android:text="Timer" /> </LinearLayout> <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <View android:layout_width="match_parent" android:layout_height="10.5dp" android:background="@color/background_gray" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <TextView android:layout_width="113dp" android:layout_height="41dp" android:gravity="center" android:text="Today" android:textColor="@color/text_gray" android:textSize="13dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="70dp" android:background="@color/white" android:paddingStart="35dp" android:paddingEnd="35dp" android:weightSum="3"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="12.1" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="h" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Runtime" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="125.1" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="Kmh" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Usage" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="11dp" android:layout_weight="1" android:background="@color/white" android:orientation="vertical"> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="992.3" android:textSize="23dp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="4dp" android:layout_weight="1" android:text="Kmh" android:textSize="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" android:text="Saving" android:textColor="@color/text_gray" android:textSize="14dp" /> </LinearLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="10.5dp" android:background="@color/background_gray" /> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Favorite" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageButton android:id="@+id/button_favorite" android:layout_width="42dp" android:layout_height="28dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/favorite_on" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Device Sharing" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageView android:layout_width="16dp" android:layout_height="16dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/sharing" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2" android:textColor="@color/text_gray" /> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/more" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="56dp" android:background="@color/white" android:gravity="center_vertical" android:paddingLeft="20dp" android:paddingRight="20dp"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="FAQ & Feedback" android:textSize="16dp" /> <!-- 占位 View,用来推动 ImageButton 到右边 --> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" /> <ImageButton android:layout_width="24dp" android:layout_height="24dp" android:background="@android:color/transparent" android:scaleType="centerInside" android:src="@drawable/more" /> </LinearLayout> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"> <View android:layout_width="320dp" android:layout_height="0.2dp" android:layout_gravity="center_horizontal" android:background="@color/text_gray" /> </FrameLayout> <View android:layout_width="match_parent" android:layout_height="280dp" android:background="@color/white" /> </LinearLayout> </ScrollView> </LinearLayout> </LinearLayout>下面会被遮挡,如果放在上面则会影响bottomsheet正常滑动,怎么解决
08-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值