CSS入门 0x2 投影、不透明度

博客主要介绍了CSS相关知识,包括简单CSS投影、CSS3投影,还提及了CSS不透明度,以及RGBa和png透明度等内容,聚焦于CSS在投影和不透明度方面的应用。

投影

    简单css投影

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>background-image</title>
        <style>
            .img-wrapper {
                background: url(./images/shadow.gif) no-repeat bottom right;
                clear: right;
                float: left;
                position: relative;
            }
            .img-wrapper img {
                background: #fff;
                border: 1px solid #a9a9a9;
                padding: 4px;
                margin: -5px 5px 5px -5px;
                position: relative;
            }
        </style>
    </head>
    <body>
        <div class="img-wrapper">
            <img src="./images/dunstan.jpg" width="300" height="300" alt="Dunstan Orchard">
        </div>
    </body>
</html>

     css3投影

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>background-image</title>
        <style>
            img {
                box-shadow: 3px 3px 6px #666;
            }
        </style>
    </head>
    <body>
        <div class="img-wrapper">
            <img src="./images/dunstan.jpg" width="300" height="300" alt="Dunstan Orchard">
        </div>
    </body>
</html>

 不透明度

    css不透明度

.alert {
    background-color:#000;
    border-radius:2em;
    opacity:0.8;
    filter:alpha(opacity=80);/*IE浏览器*/
}

    RGBa

.alert {
    background-color:rgba(0,0,0,0.8);/*alpha为十进制,代表透明度*/
    border-radius:2em;
}

    png透明度

.img-wrapper div {
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader
    (src=='/img/shadow.png',sizingMethod='crop');
    backgrounnd:none;
}

 

请使用cesium@1.107之后的版本提供的构造函数和API。全局安装@vue/cli,vue3创建cesium+three.js深度融合的项目,项目名称为vue-cesium,选择babel、vue-router、vuex、scss、Linter/F和vue3,其他的默认。删除views目录下的所有js文件和components目录下的文件,在views目录下新建CesiumView.vue文件,修改App.vue和router目录下的main.js文件,将router目录下的index.js文件里的路由器模型设置为hash模型。安装cesium和three,修改vue.config.js,在vue.config.js里添加const CesiumSourc = "node_modules/cesium/Source",添加const=CesiumWorker="../Build/Cesium/Workers",把CesiumSourc路径下的Assets、ThirdParty、Widgets复制到dist目录下。把CesiumSource路径下的CesiumWorker复制到dist目录下,把public目录下的models复制到dist目录下。在CesiumView.vue里添加 import * as Cesium from "cesium/Cesium";、 import * as THREE from "three"; 、import "cesium/Widgets/widgets.css,使用最新版本提供的构造函数或api编写代码,在CesiumView.vue中添加const czml = [ { id: "document", name: "CZML Model", version: "1.0", clock: { interval: "2025-08-07T09:30:00Z/2025-08-10T09:30:00Z", currentTime: "2025-08-07T09:30:00Z", multiplier: 1, range: "LOOP_STOP", step: "SYSTEM_CLOCK_MULTIPLIER" } }, { id: "aircraftModel", name: "Cesium Air", position: { epoch: "2025-08-07T09:30:00Z", cartographicDegrees: [ 0, 113.60194, 23.525223, 520, 1200, 113.578067, 23.541241, 1200, 2500, 113.487823, 23.594139, 2500 ], }, model: { gltf: "models/CesiumAir/Cesium_Air.glb", minimumPixelSize: 128, maximumScale: 200, }, }, ];,dataSource加载czml并监听czml获取czml模型的位置和自动调整czml模型的方向,创建particleCount数量为5000个的粒子系统,建立float32Array()缓冲区存储记录每个粒子的位置、大小、颜色、速度、随机值,使用glsl着色器渲染粒子冒烟着火的特效,把粒子系统的三维坐标转换成cesium的三维坐标添加到czml模型上显示出来。注意,此项目不添加额外的ui控制和ui显示。
08-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值